TextView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 16 Jan 2016 10:40:59 +0000
branchjv
changeset 5552 58ac0bd34b7b
parent 5550 d1911247fdf8
parent 5547 5637fb125cbf
child 5562 0219152fb99f
permissions -rw-r--r--
Merge
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
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
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
"
2191
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    12
"{ Package: 'stx:libwidg' }"
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    13
5247
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
    14
"{ NameSpace: Smalltalk }"
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
    15
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    16
ListView subclass:#TextView
3394
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    17
	instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    18
		selectionEndCol clickPos clickStartLine clickStartCol clickLine
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    19
		clickCol clickCount expandingTop wordStartCol wordStartLine
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    20
		wordEndCol wordEndLine selectionFgColor selectionBgColor
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    21
		selectStyle directoryForFileDialog defaultFileNameForFileDialog
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    22
		externalEncoding contentsWasSaved searchAction lastSearchPattern
3964
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
    23
		lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
    24
		lastSearchWasVariableSearch parenthesisSpecification dropSource
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
    25
		dragIsActive saveAction st80SelectMode searchBarActionBlock'
3394
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    26
	classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    27
		DefaultSelectionBackgroundColor
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    28
		DefaultAlternativeSelectionForegroundColor
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    29
		DefaultAlternativeSelectionBackgroundColor MatchDelayTime
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    30
		WordSelectCatchesBlanks LastSearchPatterns
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    31
		NumRememberedSearchPatterns LastSearchIgnoredCase
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
    32
		LastSearchWasMatch DefaultParenthesisSpecification
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    33
		LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText'
3394
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    34
	poolDictionaries:''
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    35
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    36
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    37
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
    38
!TextView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    39
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    40
copyright
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
 COPYRIGHT (c) 1989 by Claus Gittinger
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    43
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    44
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    45
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    46
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    47
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    48
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    49
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    50
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    51
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    52
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    53
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
    54
documentation
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    55
"
120
claus
parents: 119
diff changeset
    56
    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
    57
    The text is not editable and there is no cursor.
120
claus
parents: 119
diff changeset
    58
    Use TextViews for readonly text, EditTextView for editable text.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    59
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
    60
    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
    61
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
    62
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    63
120
claus
parents: 119
diff changeset
    64
      selectionStartLine      <Number>                the line of the selection start (or nil)
claus
parents: 119
diff changeset
    65
      selectionStartCol       <Number>                the col of the selection start
claus
parents: 119
diff changeset
    66
      selectionEndLine        <Number>                the line of the selection end
claus
parents: 119
diff changeset
    67
      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
    68
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    69
      clickStartLine          <Number>                temporary - remember where select operation started
120
claus
parents: 119
diff changeset
    70
      clickStartCol           <Number>                temporary
claus
parents: 119
diff changeset
    71
      clickLine               <Number>                temporary
claus
parents: 119
diff changeset
    72
      clickCol                <Number>                temporary
claus
parents: 119
diff changeset
    73
      clickCount              <Number>                temporary
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    74
      expandingTop            <Boolean>               temporary - for expandSelection
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    75
120
claus
parents: 119
diff changeset
    76
      selectionFgColor        <Color>                 color used to draw selections
claus
parents: 119
diff changeset
    77
      selectionBgColor        <Color>                 color used to draw selections
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    78
120
claus
parents: 119
diff changeset
    79
      selectStyle             <Symbol>                how words are selected
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    80
120
claus
parents: 119
diff changeset
    81
      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
    82
120
claus
parents: 119
diff changeset
    83
      contentsWasSaved        <Boolean>               set to true, whenever saved in a file
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
    84
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
    85
      externalEncoding        <Symbol|nil>            external encoding, used when text is saved to
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    86
						      a file. Usually something like
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    87
						      #jis7, #euc, #sjis etc.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    88
						      (currently only passed down from the
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    89
						       fileBrowser)
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
    90
96256221e3af support drag
ca
parents: 2581
diff changeset
    91
      dropSource              <DropSource>            drag operation descriptor or nil (dragging disabled)
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    92
      dragIsActive            <Boolean>               true, drag operation is activated
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    93
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    94
      searchAction            <Block>                 an autosearch action; typically set by the browser.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    95
						      Will be used as default when searchFwd/searchBwd is
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    96
						      pressed. If the searchPattern is changed, no autosearch
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    97
						      action will be executed.
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
    98
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
    99
      searchBarActionBlock    <Block>                 search action block for embedded search
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   100
						      panel. Used as second chance for searchFwd/bwd
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   101
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   102
    [class variables:]
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   103
	ST80Selections        <Boolean>               enables ST80 style doubleclick behavior
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   104
						      (right after opening parenthesis, right before
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   105
						       closing parenthesis, at begin of a line
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   106
						       at begin of text)
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   107
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   108
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   109
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   110
      textView.background                       defaults to viewBackground
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   111
      textView.ViewFont                         defaults to textFont
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   112
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   113
      text.st80Selections                       st80 behavior (click on char after parent or quote)
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   114
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   115
      text.selectionForegroundColor             defaults to textBackgroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   116
      text.selectionBackgroundColor             defaults to textForegroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   117
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   118
      text.alternativeSelectionForegroundColor  pasted text (i.e. paste will not replace)
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   119
						defaults to selectionForegroundColor
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   120
      text.alternativeSelectionBackgroundColor  pasted text (i.e. paste will not replace)
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   121
						defaults to selectionBackgroundColor
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   122
    [author:]
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   123
	Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   124
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   125
    [see also:]
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   126
	EditTextView CodeView Workspace
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   127
"
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   128
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   129
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   130
examples
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   131
"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   132
    although textViews (and instances of subclasses) are mostly used
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   133
    as components (in the fileBrowser, the browser, the launcher etc.),
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   134
    they may also be opened as a textEditor;
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   135
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   136
    open a (readonly) textView on some information text:
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   137
							[exBegin]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   138
	TextView
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   139
	    openWith:'read this'
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   140
	    title:'demonstration'
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   141
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   142
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   143
    the same, but open it modal:
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   144
							[exBegin]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   145
	TextView
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   146
	    openModalWith:'read this first'
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   147
	    title:'demonstration'
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   148
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   149
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   150
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   151
    open it modal (but editable) on some text:
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   152
    (must accept before closing)
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   153
    This is somewhat kludgy - when closed, the view has already
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   154
    nilled its link to the model. Therefore, the accept must be
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   155
    done 'manually' below.
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   156
    However, usually an applicationModel is installed as the
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   157
    editor-topViews application. This would get a closeRequest,
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   158
    where it could handle things.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   159
							[exBegin]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   160
	|m textView|
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   161
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   162
	m := 'read this first' asValue.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   163
	textView := EditTextView openModalOnModel:m.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   164
	textView modified ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   165
	    (self confirm:'text was not accepted - do it now ?')
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   166
	    ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   167
		m value:textView contents
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   168
	    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   169
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   170
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   171
	Transcript showCR:m value.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   172
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   173
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   174
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   175
    open a textEditor on some file:
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   176
							[exBegin]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   177
	EditTextView openOn:'Makefile'
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   178
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   179
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   180
"
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   181
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   182
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   183
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   184
!TextView class methodsFor:'instance creation'!
119
claus
parents: 97
diff changeset
   185
claus
parents: 97
diff changeset
   186
on:aModel aspect:aspect change:change menu:menu initialSelection:initial
claus
parents: 97
diff changeset
   187
    "for ST-80 compatibility"
claus
parents: 97
diff changeset
   188
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   189
    ^ (self new)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   190
	on:aModel
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   191
	aspect:aspect
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   192
	list:aspect
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   193
	change:change
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   194
	menu:menu
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   195
	initialSelection:initial
3280
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   196
!
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   197
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   198
with:someText
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   199
    ^ (self new)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   200
	contents:someText
119
claus
parents: 97
diff changeset
   201
! !
claus
parents: 97
diff changeset
   202
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   203
!TextView class methodsFor:'class initialization'!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   204
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   205
initialize
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   206
    DefaultParenthesisSpecification isNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   207
	DefaultParenthesisSpecification := IdentityDictionary new.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   208
	DefaultParenthesisSpecification at:#open        put:#( $( $[ ${ "$> $<") .
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   209
	DefaultParenthesisSpecification at:#close       put:#( $) $] $} "$> $<").
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   210
	DefaultParenthesisSpecification at:#ignore      put:#( $' $" '$[' '$]' '${' '$)' ).
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   211
	DefaultParenthesisSpecification at:#eolComment  put:'"/'.     "/ sigh - must be 2 characters
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   212
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   213
! !
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   214
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   215
!TextView class methodsFor:'defaults'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
   216
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   217
defaultIcon
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   218
    "return the default icon if started as a topView"
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   219
3496
8c92a96c4e27 icon resource
Claus Gittinger <cg@exept.de>
parents: 3491
diff changeset
   220
    <resource: #programImage>
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   221
    <resource: #style (#ICON #ICON_FILE)>
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   222
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   223
    |nm i|
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   224
1146
027884518745 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   225
    i := self classResources at:'ICON' default:nil.
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   226
    i isNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   227
	nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   228
	i := Smalltalk imageFromFileNamed:nm forClass:self.
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   229
    ].
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   230
    i notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   231
	i := i onDevice:Display
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   232
    ].
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   233
    ^ i
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   234
3496
8c92a96c4e27 icon resource
Claus Gittinger <cg@exept.de>
parents: 3491
diff changeset
   235
    "Modified: / 17-09-2007 / 11:36:29 / cg"
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   236
!
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   237
910
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   238
defaultMenuMessage
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   239
    "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
   240
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   241
    ^ #editMenu
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   242
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   243
    "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
   244
!
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   245
4254
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   246
defaultParenthesisSpecification
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   247
    ^ DefaultParenthesisSpecification
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   248
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   249
    "Created: / 14-06-2011 / 14:00:59 / cg"
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   250
!
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   251
2306
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   252
defaultSelectionBackgroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   253
    "return the default selection background color"
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   254
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   255
    ^DefaultSelectionBackgroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   256
!
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   257
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   258
defaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   259
    "return the default selection foreground color"
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   260
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   261
    ^DefaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   262
!
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   263
1477
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   264
defaultViewBackgroundColor
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   265
    "return the default view background"
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   266
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   267
    ^DefaultViewBackground
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   268
!
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   269
3226
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   270
lastSearchIgnoredCase
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   271
    ^ LastSearchIgnoredCase
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   272
!
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   273
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   274
lastSearchWasMatch
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   275
    ^ LastSearchWasMatch
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   276
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   277
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   278
st80SelectMode
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   279
    ^ UserPreferences current st80SelectMode
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   280
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   281
    "Modified: / 03-07-2006 / 16:26:44 / cg"
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   282
!
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   283
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   284
st80SelectMode:aBoolean
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   285
    UserPreferences current st80SelectMode:aBoolean
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   286
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   287
    "Created: / 07-01-1999 / 13:35:24 / cg"
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   288
    "Modified: / 03-07-2006 / 16:27:01 / cg"
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   289
!
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   290
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
   291
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   292
    "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
   293
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   294
    <resource: #style (#'textView.background'
5087
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   295
                       #'text.selectionForegroundColor'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   296
                       #'text.selectionBackgroundColor'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   297
                       #'text.alternativeSelectionForegroundColor'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   298
                       #'text.alternativeSelectionBackgroundColor'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   299
                       #'textView.font'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   300
                       #'text.wordSelectCatchesBlanks'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   301
                       #'text.st80Selections')>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   302
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   303
    DefaultViewBackground := StyleSheet colorAt:'textView.background' default:Color white.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   304
    DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   305
    DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'.
2630
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   306
"/    DefaultAlternativeSelectionForegroundColor := StyleSheet colorAt:'text.alternativeSelectionForegroundColor' default:DefaultSelectionForegroundColor.
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   307
"/    DefaultAlternativeSelectionBackgroundColor := StyleSheet colorAt:'text.alternativeSelectionBackgroundColor' default:DefaultSelectionBackgroundColor.
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   308
    DefaultAlternativeSelectionForegroundColor := DefaultSelectionForegroundColor.
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   309
    DefaultAlternativeSelectionBackgroundColor := DefaultSelectionBackgroundColor.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   310
    DefaultFont := StyleSheet fontAt:'textView.font'.
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
   311
    MatchDelayTime := 0.6.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   312
    WordSelectCatchesBlanks := StyleSheet at:'text.wordSelectCatchesBlanks' default:false.
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   313
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   314
    "Modified: / 03-07-2006 / 16:29:42 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   315
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   316
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   317
!TextView class methodsFor:'help specs'!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   318
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   319
flyByHelpSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   320
    "This resource specification was automatically generated
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   321
     by the UIHelpTool of ST/X."
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   322
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   323
    "Do not manually edit this!! If it is corrupted,
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   324
     the UIHelpTool may not be able to read the specification."
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   325
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   326
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   327
     UIHelpTool openOnClass:TextView
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   328
    "
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   329
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   330
    <resource: #help>
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   331
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   332
    ^ Dictionary new addPairsFrom:#(
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   333
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   334
#matchSearch
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   335
'Search for a pattern (glob) as opposed to a direct string search'
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   336
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   337
#searchCaseSensitive
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   338
'Care for case differences'
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   339
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   340
#searchFullWord
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   341
'Search only for full words (ignore occurrences as substring)'
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   342
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   343
#searchAtBeginOfLineOnly
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   344
'Search only for the string at the beginning if a line'
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   345
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   346
#searchPattern
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   347
'String or match-pattern to be searched'
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   348
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   349
#searchVariable
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   350
'Search only for that variable name (ignore occurrences in other contexts)'
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   351
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   352
#replaceText
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   353
'If checked, matching text is replaced by this (everywhere)'
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   354
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   355
#selectLines
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   356
'If checked, lines containing the matched string are selected.'
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   357
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   358
)
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   359
! !
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   360
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   361
!TextView class methodsFor:'interface specs'!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   362
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   363
searchDialogSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   364
    "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
   365
     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
   366
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   367
    "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
   368
     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
   369
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   370
    "
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   371
     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
   372
    "
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   373
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   374
    <resource: #canvas>
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   375
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   376
    ^
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   377
    #(FullSpec
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   378
       name: searchDialogSpec
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   379
       window:
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   380
      (WindowSpec
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   381
	 label: 'String search'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   382
	 name: 'String search'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   383
	 min: (Point 10 10)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   384
	 max: (Point 1280 1024)
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   385
         bounds: (Rectangle 0 0 420 323)
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   386
       )
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   387
       component:
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   388
      (SpecCollection
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   389
	 collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   390
	  (LabelSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   391
	     label: 'SearchPattern:'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   392
	     name: 'label'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   393
	     layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   394
	     level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   395
	     translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   396
	     adjust: left
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   397
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   398
	  (ComboBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   399
	     name: 'patternComboBox'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   400
	     layout: (LayoutFrame 2 0.0 26 0 -2 1.0 48 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   401
	     activeHelpKey: searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   402
	     tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   403
	     model: searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   404
	     immediateAccept: false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   405
	     acceptOnLeave: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   406
	     acceptOnReturn: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   407
	     acceptOnTab: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   408
	     acceptOnLostFocus: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   409
	     acceptOnPointerLeave: false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   410
	     autoSelectInitialText: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   411
	     comboList: patternList
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   412
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   413
	  (VerticalPanelViewSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   414
	     name: 'VerticalPanel1'
5460
c353fd71390d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5443
diff changeset
   415
             layout: (LayoutFrame 0 0.0 52 0 0 1.0 -32 1)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   416
	     horizontalLayout: fit
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   417
	     verticalLayout: top
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   418
	     component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   419
	    (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   420
	       collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   421
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   422
		   label: 'Case Sensitive'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   423
		   name: 'ignoreCaseCheckBox'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   424
		   activeHelpKey: searchCaseSensitive
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   425
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   426
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   427
		   model: caseSensitive
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   428
		   translateLabel: true
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   429
                   extent: (Point 420 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   430
		 )
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   431
                (ViewSpec
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   432
                   name: 'MatchBox'
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   433
                   component: 
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   434
                  (SpecCollection
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   435
                     collection: (
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   436
                      (CheckBoxSpec
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   437
                         label: 'Match (forward only)'
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   438
                         name: 'matchCheckBox'
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   439
                         layout: (LayoutFrame 0 0 0 0 260 0 0 1)
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   440
                         activeHelpKey: matchSearch
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   441
                         level: 0
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   442
                         tabable: true
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   443
                         model: match
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   444
                         translateLabel: true
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   445
                       )
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   446
                      (CheckBoxSpec
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   447
                         label: 'Regex Match'
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   448
                         name: 'CheckBox6'
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   449
                         layout: (LayoutFrame -151 1 0 0 0 1 22 0)
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   450
                         visibilityChannel: matchWithRegexVisible
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   451
                         enableChannel: match
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   452
                         model: matchWithRegex
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   453
                         translateLabel: true
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   454
                       )
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   455
                      )
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   456
                    
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   457
                   )
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   458
                   extent: (Point 420 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   459
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   460
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   461
		   label: 'Search Full Words'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   462
		   name: 'CheckBox2'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   463
		   activeHelpKey: searchFullWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   464
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   465
		   enableChannel: searchFullWordEnabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   466
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   467
		   model: searchFullWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   468
		   translateLabel: true
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   469
                   extent: (Point 420 24)
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   470
                 )
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   471
                (CheckBoxSpec
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   472
                   label: 'At Begin of Line Only'
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   473
                   name: 'CheckBox5'
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   474
                   activeHelpKey: searchAtBeginOfLineOnly
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   475
                   level: 0
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   476
                   tabable: true
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   477
                   model: searchAtBeginOfLineOnly
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   478
                   translateLabel: true
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   479
                   extent: (Point 420 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   480
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   481
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   482
		   label: 'Variable Only'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   483
		   name: 'CheckBox1'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   484
		   activeHelpKey: searchVariable
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   485
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   486
		   visibilityChannel: searchVariableVisible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   487
		   enableChannel: searchVariableEnabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   488
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   489
		   model: searchVariable
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   490
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   491
		   labelChannel: stringWithVariableUnderCursorHolder
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   492
                   extent: (Point 420 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   493
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   494
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   495
		   label: 'Select Lines'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   496
		   name: 'CheckBox3'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   497
		   activeHelpKey: selectLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   498
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   499
		   initiallyInvisible: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   500
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   501
		   model: selectLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   502
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   503
		   extent: (Point 302 24)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   504
		 )
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   505
                (CheckBoxSpec
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   506
                   label: 'Wrap at End of Text (forward only)'
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   507
                   name: 'CheckBox7'
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   508
                   activeHelpKey: searchAtBeginOfLineOnly
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   509
                   level: 0
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   510
                   tabable: true
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   511
                   model: wrapAtEndOfTextHolder
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   512
                   translateLabel: true
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   513
                   extent: (Point 420 24)
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   514
                 )
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   515
		(ViewSpec
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   516
                   name: 'ReplaceBox'
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   517
		   component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   518
		  (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   519
		     collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   520
		      (CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   521
			 label: 'Global Replace With:'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   522
			 name: 'CheckBox4'
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   523
                         layout: (LayoutFrame 0 0 0 0 180 0 23 0)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   524
			 activeHelpKey: replaceText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   525
			 level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   526
			 enableChannel: replaceEnabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   527
			 tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   528
			 model: replaceBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   529
			 translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   530
		       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   531
		      (InputFieldSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   532
			 name: 'ReplaceEntryField'
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   533
                         layout: (LayoutFrame 180 0 0 0 -2 1 22 0)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   534
			 activeHelpKey: replaceText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   535
			 visibilityChannel: replaceBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   536
			 enableChannel: replaceBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   537
			 model: replaceTextHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   538
			 acceptOnReturn: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   539
			 acceptOnTab: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   540
			 acceptOnPointerLeave: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   541
		       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   542
		      )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   543
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   544
		   )
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   545
                   extent: (Point 420 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   546
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   547
		)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   548
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   549
	     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   550
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   551
	  (HorizontalPanelViewSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   552
	     name: 'horizontalPanelView'
5460
c353fd71390d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5443
diff changeset
   553
             layout: (LayoutFrame 0 0.0 -32 1.0 -16 1.0 0 1.0)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   554
	     level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   555
	     horizontalLayout: fitSpace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   556
	     verticalLayout: center
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   557
	     horizontalSpace: 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   558
	     verticalSpace: 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   559
	     ignoreInvisibleComponents: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   560
	     reverseOrderIfOKAtLeft: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   561
	     component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   562
	    (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   563
	       collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   564
		(ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   565
		   label: 'Cancel'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   566
		   name: 'cancelButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   567
		   level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   568
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   569
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   570
		   model: cancel
5460
c353fd71390d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5443
diff changeset
   571
                   useDefaultExtent: true
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   572
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   573
		(ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   574
		   label: 'Prev'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   575
		   name: 'prevButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   576
		   level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   577
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   578
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   579
		   model: prevAction
5460
c353fd71390d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5443
diff changeset
   580
                   useDefaultExtent: true
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   581
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   582
		(ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   583
		   label: 'Next'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   584
		   name: 'nextButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   585
		   level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   586
		   borderWidth: 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   587
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   588
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   589
		   model: nextAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   590
		   isDefault: true
5460
c353fd71390d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5443
diff changeset
   591
                   useDefaultExtent: true
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   592
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   593
		)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   594
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   595
	     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   596
	     keepSpaceForOSXResizeHandleH: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   597
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   598
	  )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   599
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   600
       )
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   601
     )
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   602
! !
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   603
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   604
!TextView class methodsFor:'startup'!
121
claus
parents: 120
diff changeset
   605
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   606
open
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   607
    "start an empty TextView"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   608
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   609
    ^ self openWith:nil
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   610
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   611
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   612
openModalOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   613
    "start a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   614
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   615
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   616
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   617
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   618
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   619
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   620
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   621
    "Created: 14.2.1997 / 15:24:12 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   622
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   623
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   624
openModalWith:aString
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   625
    "start a textView with aString as initial contents"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   626
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   627
    ^ self openModalWith:aString title:nil
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   628
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   629
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   630
     TextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   631
     EditTextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   632
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   633
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   634
    "Created: 14.2.1997 / 15:19:04 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   635
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   636
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   637
openModalWith:aString title:aTitle
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   638
    "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
   639
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   640
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   641
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   642
    textView := self setupWith:aString title:aTitle.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   643
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   644
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   645
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   646
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   647
     TextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   648
     EditTextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   649
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   650
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   651
    "Modified: 9.9.1996 / 19:32:29 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   652
    "Created: 14.2.1997 / 15:19:18 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   653
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   654
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   655
openOn:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   656
    "start a textView on a file; return the textView"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   657
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   658
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   659
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   660
    textView := self setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   661
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   662
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   663
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   664
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   665
     TextView openOn:'../../doc/overview.doc'
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   666
     EditTextView openOn:'../../doc/overview.doc'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   667
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   668
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   669
    "Modified: 14.2.1997 / 15:21:51 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   670
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   671
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   672
openOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   673
    "start a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   674
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   675
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   676
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   677
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   678
    textView topView open.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   679
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   680
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   681
    "Created: 14.2.1997 / 15:23:36 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   682
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   683
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   684
openWith:aStringOrStringCollection
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   685
    "start a textView with aStringOrStringCollection as initial contents"
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   686
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   687
    ^ self openWith:aStringOrStringCollection selected:false
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   688
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   689
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   690
     TextView openWith:'some text'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   691
     EditTextView openWith:'some text'
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
   692
     Workspace openWith:'some text'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   693
    "
119
claus
parents: 97
diff changeset
   694
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   695
    "Created: 10.12.1995 / 17:41:32 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   696
    "Modified: 5.3.1997 / 15:37:19 / cg"
126
claus
parents: 121
diff changeset
   697
!
claus
parents: 121
diff changeset
   698
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   699
openWith:aStringOrStringCollection selected:selectedBoolean
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   700
    "start a textView with aStringOrStringCollection as initial (optionally selected) contents.
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   701
     Return the textView."
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   702
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   703
    |textView|
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   704
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   705
    textView := self setupEmpty.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   706
    textView contents:aStringOrStringCollection selected:selectedBoolean.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   707
    textView topView open.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   708
    ^ textView
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   709
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   710
    "
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   711
     TextView openWith:'some text' selected:true
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   712
     EditTextView openWith:'some text' selected:false
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   713
    "
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   714
!
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   715
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   716
openWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   717
    "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
   718
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   719
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   720
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   721
    textView := self setupWith:aStringOrStringCollection title:aTitle.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   722
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   723
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   724
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   725
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   726
     TextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   727
     EditTextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   728
    "
126
claus
parents: 121
diff changeset
   729
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   730
    "Created: 10.12.1995 / 17:40:02 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   731
    "Modified: 5.3.1997 / 15:37:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   732
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   733
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   734
setupEmpty
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   735
    "create a textview in a topview, with horizontal and
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   736
     vertical scrollbars - a helper for #startWith: and #startOn:"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   737
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   738
    |top frame label|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   739
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   740
    label := 'unnamed'.
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   741
    top := StandardSystemView label:label icon:self defaultIcon.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   742
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   743
    frame := HVScrollableView
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   744
		for:self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   745
		miniScrollerH:true miniScrollerV:false
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   746
		in:top.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   747
    frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   748
    ^ frame scrolledView
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   749
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   750
    "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
   751
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   752
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   753
setupForFile:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   754
    "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
   755
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   756
    |textView|
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   757
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   758
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   759
    aFileName notNil ifTrue:[
5087
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   760
        textView setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   761
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   762
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   763
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   764
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
   765
    "Created: / 14-02-1997 / 15:21:43 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
   766
    "Modified: / 25-10-2006 / 14:46:54 / cg"
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   767
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   768
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   769
setupForModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   770
    "setup a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   771
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   772
    |textView|
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   773
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   774
    textView := self setupEmpty.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   775
    textView model:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   776
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   777
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   778
    "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
   779
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   780
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   781
setupWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   782
    "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
   783
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   784
    |top textView|
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   785
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   786
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   787
    top := textView topView.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   788
    aTitle notNil ifTrue:[top label:aTitle].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   789
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   790
    aStringOrStringCollection notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   791
	textView contents:aStringOrStringCollection
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   792
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   793
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   794
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   795
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   796
    "Created: 9.9.1996 / 19:31:22 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   797
    "Modified: 5.3.1997 / 15:37:37 / cg"
119
claus
parents: 97
diff changeset
   798
! !
claus
parents: 97
diff changeset
   799
2744
cb920467a4b4 method category rename
Claus Gittinger <cg@exept.de>
parents: 2740
diff changeset
   800
!TextView methodsFor:'Compatibility-ST80'!
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   801
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   802
displaySelection:aBoolean
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   803
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   804
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   805
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   806
2118
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   807
editText:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   808
    "ST-80 compatibility: set the edited text."
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   809
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   810
    self contents:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   811
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   812
    "Created: / 5.2.2000 / 17:06:18 / cg"
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   813
!
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   814
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   815
selectAndScroll
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   816
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   817
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   818
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   819
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   820
selectFrom:startPos to:endPos
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   821
    "change the selection given two character positions."
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   822
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   823
    self selectFromCharacterPosition:startPos to:endPos
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   824
!
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   825
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   826
selectionStartIndex
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   827
    "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
   828
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   829
    ^ self characterPositionOfSelection
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   830
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   831
    "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
   832
!
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   833
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   834
selectionStopIndex
2052
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   835
    "ST-80 compatibility: return the character position of
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   836
     the character right after the selection."
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   837
2109
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   838
    |idx|
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   839
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   840
    idx := self characterPositionOfSelectionEnd.
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   841
    idx == 0 ifTrue:[^ 0].
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   842
    ^ idx + 1
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   843
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   844
    "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
   845
! !
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   846
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   847
!TextView methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   848
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   849
characterEncoding:encodingArg
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
   850
    "define how the contents is encoded internally.
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   851
     This should normally never be required, as ST/X now assumes
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   852
     unicode (of which iso8859-1 is a subset) encoding.
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   853
     The possibility to change the characterEncoding is provided as
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   854
     a backward compatibility hook for programs which want to use
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   855
     another encoding internally."
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   856
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   857
    |encodingSymOrNil|
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   858
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   859
    encodingSymOrNil := encodingArg isNil
5070
897edc4879ed class: TextView
Claus Gittinger <cg@exept.de>
parents: 5052
diff changeset
   860
                            ifTrue:[#'iso10646-1']
897edc4879ed class: TextView
Claus Gittinger <cg@exept.de>
parents: 5052
diff changeset
   861
                            ifFalse:[encodingArg asSymbol].
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   862
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   863
    gc characterEncoding ~~ encodingSymOrNil ifTrue:[
5070
897edc4879ed class: TextView
Claus Gittinger <cg@exept.de>
parents: 5052
diff changeset
   864
        "/ TODO: reencode contents if required.
5523
1d2ed51687e2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5460
diff changeset
   865
"/        (list size ~~ 0
1d2ed51687e2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5460
diff changeset
   866
"/        and:[ list contains:[:line | line size > 0]]) ifTrue:[
1d2ed51687e2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5460
diff changeset
   867
"/            (self confirm:(resources stringWithCRs:'Your text may need to be re-coded - this is not yet supported.\\Proceed ?'))
1d2ed51687e2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5460
diff changeset
   868
"/            ifFalse:[^ self].
1d2ed51687e2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5460
diff changeset
   869
"/        ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   870
	super characterEncoding:encodingSymOrNil.
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   871
    ].
4361
646cd7c5513e comment/format in: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents: 4321
diff changeset
   872
646cd7c5513e comment/format in: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents: 4321
diff changeset
   873
    "Modified (format): / 25-01-2012 / 00:28:27 / cg"
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
   874
!
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
   875
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   876
characterPositionOfSelection
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   877
    "return the character index of the first character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   878
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   879
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   880
    selectionStartLine isNil ifTrue:[^ 0].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   881
    ^ self characterPositionOfLine:selectionStartLine
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   882
			       col:selectionStartCol
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   883
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   884
    "Modified: 14.8.1997 / 16:35:37 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   885
!
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   886
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   887
characterPositionOfSelectionEnd
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   888
    "return the character index of the last character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   889
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   890
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   891
    selectionStartLine isNil ifTrue:[^ 0].
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   892
    ^ self characterPositionOfLine:selectionEndLine
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   893
			       col:selectionEndCol
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   894
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   895
    "Created: 14.8.1997 / 16:35:24 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   896
    "Modified: 14.8.1997 / 16:35:45 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   897
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   898
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   899
contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   900
    "return true, if the contents was saved (by a save action),
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   901
     false if not (or was modified again after the last save)."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   902
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   903
    ^ contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   904
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   905
3214
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   906
contentsWasSaved:aBoolean
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   907
    contentsWasSaved := aBoolean
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   908
!
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   909
3212
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   910
defaultFileNameForFileDialog
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   911
    "return the default fileName to use for the save-box"
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   912
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   913
    ^ defaultFileNameForFileDialog
3212
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   914
!
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   915
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   916
defaultFileNameForFileDialog:aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   917
    "define the default fileName to use for the save-box"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   918
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   919
    defaultFileNameForFileDialog := aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   920
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   921
    "Created: 13.2.1997 / 18:29:53 / cg"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   922
!
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   923
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   924
directoryForFileDialog:aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   925
    "define the default directory to use for save-box"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   926
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   927
    directoryForFileDialog := aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   928
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   929
    "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
   930
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   931
2941
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   932
externalEncoding
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   933
    "return the encoding used when the contents is saved via the 'save / save as' dialog.
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   934
     This is (currently only) passed down from the fileBrowser,
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   935
     and required when  utf8/japanese/chinese/korean text is edited.
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   936
     (encoding is something like #utf8 #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc).
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   937
     Notice: this only affects the external representation of the text."
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   938
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   939
    ^ externalEncoding
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   940
!
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   941
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   942
externalEncoding:encodingSymOrNil
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   943
    "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
   944
     via the 'save / save as' dialog.
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   945
     This is (currently only) passed down from the fileBrowser,
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   946
     and required when  utf8/japanese/chinese/korean text is edited.
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   947
     (encoding is something like #utf8 #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc).
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   948
     Notice: this only affects the external representation of the text."
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   949
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   950
    externalEncoding := encodingSymOrNil
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   951
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   952
2581
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   953
parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   954
    "return the value of the instance variable 'parenthesisSpecification' (automatically generated)"
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   955
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   956
    ^ parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   957
!
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   958
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   959
parenthesisSpecification:aDictionary
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   960
    "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
   961
     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
   962
     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
   963
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   964
    parenthesisSpecification := aDictionary
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   965
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   966
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   967
saveAction:something
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   968
    saveAction := something.
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   969
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   970
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   971
searchBarActionBlock
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   972
    ^ searchBarActionBlock
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   973
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   974
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   975
searchBarActionBlock:something
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   976
    searchBarActionBlock := something.
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   977
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   978
3787
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   979
!TextView methodsFor:'accessing-behavior'!
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   980
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   981
isReadOnly
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   982
    ^ true
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   983
!
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   984
3787
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   985
readOnly:aBoolean
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   986
    "for protocol compatibility with editTextViews,
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   987
     but actually ignored"
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   988
! !
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   989
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   990
!TextView methodsFor:'accessing-contents'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   991
2791
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
   992
contents:newContents selected:selectedBoolean
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
   993
    self contents:newContents.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
   994
    selectedBoolean ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   995
	list size == 1 ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   996
	    self selectFromLine:1 col:1 toLine:1 col:(list at:1) size
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   997
	] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   998
	    self selectAll
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   999
	]
2791
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1000
    ]
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1001
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1002
    "
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1003
     |w|
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1004
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1005
     w := Workspace new open.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1006
     w contents:'Hello world' selected:true.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1007
    "
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1008
!
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1009
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1010
fromFile:aFileName
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1011
    "take contents from a named file"
3724
5db1580f82ba mark obsolete message
Stefan Vogel <sv@exept.de>
parents: 3708
diff changeset
  1012
    <resource: #obsolete>
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1013
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1014
    self obsoleteMethodWarning.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1015
    ^ self loadTextFile:aFileName.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1016
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1017
    "Modified: / 25-10-2006 / 14:47:35 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1018
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1019
4755
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1020
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1021
    "set the displayed contents (a collection of strings) with redraw.
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1022
     Redefined since changing the contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1023
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1024
    self unselect.
4755
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1025
    super list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1026
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1027
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1028
loadTextFile:aFileName
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1029
    "take contents from a named file"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1030
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1031
    |f|
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1032
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1033
    f := aFileName asFilename.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1034
    self directoryForFileDialog:(f directoryName).
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1035
    self contents:(f contents)
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1036
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1037
    "Created: / 25-10-2006 / 14:44:01 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1038
!
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1039
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1040
setContents:something
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1041
    "set the contents (either a string or a Collection of strings)
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1042
     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
  1043
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1044
    |selStartLine selStartCol selEndLine selEndCol selStyle|
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1045
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1046
    selStartLine := selectionStartLine.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1047
    selStartCol := selectionStartCol.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1048
    selEndLine := selectionEndLine.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1049
    selEndCol := selectionEndCol.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1050
    selStyle := selectStyle.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1051
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1052
    super setContents:something.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1053
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1054
    selStartLine notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1055
	self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1056
	    selectFromLine:selStartLine col:selStartCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1057
	    toLine:selEndLine col:selEndCol.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1058
	selectStyle := selStyle
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1059
    ].
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1060
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1061
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1062
    "Modified: / 31.3.1998 / 23:33:21 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1063
!
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1064
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1065
setList:something
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1066
    "set the displayed contents (a collection of strings)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1067
     without redraw.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1068
     Redefined since changing contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1069
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1070
    self unselect.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1071
    super setList:something
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1072
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1073
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1074
setupForFile:aFileName
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1075
    "take contents from a named file"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1076
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1077
    |baseName|
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1078
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1079
    self loadTextFile:aFileName.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1080
    aFileName notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1081
	baseName := aFileName asFilename baseName.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1082
	self topView label:baseName.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1083
	self defaultFileNameForFileDialog:baseName.
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1084
    ].
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1085
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1086
    "Created: / 25-10-2006 / 14:47:13 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1087
!
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1088
1487
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1089
text
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1090
    "for ST80 compatibility"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1091
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1092
    ^ self contents
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1093
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1094
    "Created: / 19.4.1998 / 12:53:10 / cg"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1095
!
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1096
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1097
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
  1098
    "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
  1099
     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
  1100
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1101
    |beginCol endCol endLine thisCharacter flag|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1102
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1103
    flag := #word.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1104
    beginCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1105
    endCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1106
    endLine := selectLine.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1107
    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
  1108
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1109
    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
  1110
    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
  1111
    endCol == 0 ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1112
	endLine := selectLine + 1
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1113
    ].
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1114
1750
d87cc464fde2 comment
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1115
    "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
  1116
    (wordCheck value:thisCharacter) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1117
	"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1118
	 try to catch a blank ...
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1119
	"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1120
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1121
	WordSelectCatchesBlanks ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1122
	    ((beginCol == 1)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1123
	    or:[(self characterAtLine:selectLine col:(beginCol - 1))
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1124
		 ~~ Character space]) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1125
		((self characterAtLine:selectLine col:(endCol + 1))
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1126
		  == Character space) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1127
		    endCol := endCol + 1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1128
		    flag := #wordRight
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1129
		]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1130
	    ] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1131
		beginCol := beginCol - 1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1132
		flag := #wordLeft
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1133
	    ].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1134
	].
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1135
    ].
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1136
    aFiveArgBlock value:selectLine
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1137
		  value:beginCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1138
		  value:endLine
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1139
		  value:endCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1140
		  value:flag
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1141
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1142
    "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
  1143
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1144
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1145
!TextView methodsFor:'accessing-look'!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1146
2027
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1147
selectionBackgroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1148
    "return the selection-background color."
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1149
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1150
    ^ selectionBgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1151
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1152
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1153
selectionForegroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1154
    "return the selection-foreground color."
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1155
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1156
    ^ selectionFgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1157
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1158
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1159
selectionForegroundColor:color1 backgroundColor:color2
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1160
    "set both the selection-foreground and cursor background colors.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1161
     The default is defined by the styleSheet;
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1162
     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
  1163
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1164
    selectionFgColor := color1 onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1165
    selectionBgColor := color2 onDevice:self graphicsDevice.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2900
diff changeset
  1166
    self hasSelection ifTrue:[
5087
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
  1167
        self invalidate
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1168
    ]
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1169
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 715
diff changeset
  1170
    "Modified: 29.5.1996 / 16:22:15 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1171
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1172
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1173
!TextView methodsFor:'accessing-mvc'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1174
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1175
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
  1176
    "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
  1177
     and selection. Added for ST-80 compatibility"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1178
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1179
    aspectSym notNil ifTrue:[aspectMsg := aspectSym.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1180
			     listMsg isNil ifTrue:[listMsg := aspectSym]].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1181
    changeSym notNil ifTrue:[changeMsg := changeSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1182
    listSym notNil ifTrue:[listMsg := listSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1183
    menuSym notNil ifTrue:[menuMsg := menuSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1184
"/    initial notNil ifTrue:[initialSelectionMsg := initial].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1185
    self model:aModel.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1186
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1187
    "Modified: 15.8.1996 / 12:52:54 / stefan"
906
a8b9b481ce70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1188
    "Modified: 2.1.1997 / 16:11:28 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1189
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1190
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1191
!TextView methodsFor:'drag & drop'!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1192
96256221e3af support drag
ca
parents: 2581
diff changeset
  1193
allowDrag:aBoolean
96256221e3af support drag
ca
parents: 2581
diff changeset
  1194
    "enable/disable dragging support
96256221e3af support drag
ca
parents: 2581
diff changeset
  1195
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  1196
    aBoolean ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1197
	dropSource := nil.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1198
    ] ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1199
	dropSource isNil ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1200
	    dropSource := DropSource
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1201
			    receiver:self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1202
			    argument:nil
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1203
			    dropObjectSelector:#collectionOfDragObjects
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1204
			    displayObjectSelector:nil
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1205
	]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1206
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  1207
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1208
96256221e3af support drag
ca
parents: 2581
diff changeset
  1209
canDrag
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1210
    "returns true if dragging is enabled"
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1211
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1212
    ^ dropSource notNil and:[ self hasSelection ]
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1213
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1214
    "Modified (comment): / 12-02-2012 / 08:37:21 / cg"
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1215
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1216
96256221e3af support drag
ca
parents: 2581
diff changeset
  1217
collectionOfDragObjects
96256221e3af support drag
ca
parents: 2581
diff changeset
  1218
    "returns collection of dragable objects assigned to selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  1219
     Here, by default, a collection of text-dragObjects is generated;
96256221e3af support drag
ca
parents: 2581
diff changeset
  1220
     however, if a dragObjectConverter is defined, that one gets a chance
96256221e3af support drag
ca
parents: 2581
diff changeset
  1221
     to convert as appropriate.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1222
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  1223
    |selection|
96256221e3af support drag
ca
parents: 2581
diff changeset
  1224
96256221e3af support drag
ca
parents: 2581
diff changeset
  1225
    selection := self selection.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1226
96256221e3af support drag
ca
parents: 2581
diff changeset
  1227
    selection size == 0 ifTrue:[^ nil].
5249
cc785134a690 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1228
    ^ Array with:(DropObject newText:selection).
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1229
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1230
96256221e3af support drag
ca
parents: 2581
diff changeset
  1231
dropSource
3245
b17c15b61e94 ugly comments
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  1232
    "returns the dropSource or nil"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1233
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1234
    ^ dropSource
96256221e3af support drag
ca
parents: 2581
diff changeset
  1235
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1236
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1237
dropSource:aDropSourceOrNil
3245
b17c15b61e94 ugly comments
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  1238
    "set the dropSource or nil"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1239
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1240
    dropSource := aDropSourceOrNil.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1241
! !
96256221e3af support drag
ca
parents: 2581
diff changeset
  1242
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1243
!TextView methodsFor:'encoding'!
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1244
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1245
validateFontEncodingFor:newEncoding ask:ask
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1246
    "if required, query user if he/she wants to change to another font,
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1247
     which is able to display text encoded as specified by newEncoding"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1248
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1249
    |fontsEncoding msg filter f defaultFont pref matchingFonts
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1250
     matchingFamilyFonts matchingFamilyFaceFonts matchingFamilyFaceStyleFonts
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1251
     matchingFamilyFaceStyleSizeFonts|
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1252
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1253
    fontsEncoding := gc font encoding.
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1254
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1255
    pref := FontDescription preferredFontEncodingFor:newEncoding.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1256
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1257
    (pref match:fontsEncoding) ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1258
        ^ self
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1259
    ].
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1260
    (fontsEncoding notNil and:[CharacterEncoder isEncoding:pref subSetOf:fontsEncoding]) ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1261
        ^ self
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1262
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1263
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1264
    filter := [:f | |coding|
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1265
                    (coding := f encoding) notNil
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1266
                    and:[pref match:coding]].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1267
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1268
    self graphicsDevice flushListOfAvailableFonts.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1269
    matchingFonts := self graphicsDevice listOfAvailableFonts select:filter.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1270
    matchingFamilyFonts := matchingFonts select:[:f | f family = gc font family].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1271
    matchingFamilyFaceFonts := matchingFamilyFonts select:[:f | f face = gc font face].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1272
    matchingFamilyFaceStyleFonts := matchingFamilyFaceFonts select:[:f | f style = gc font style].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1273
    matchingFamilyFaceStyleSizeFonts := matchingFamilyFaceStyleFonts select:[:f | f size = gc font size].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1274
    matchingFamilyFaceStyleSizeFonts size > 0 ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1275
        defaultFont := matchingFamilyFaceStyleSizeFonts first
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1276
    ] ifFalse:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1277
        matchingFamilyFaceStyleFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1278
            defaultFont := matchingFamilyFaceStyleFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1279
        ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1280
            matchingFamilyFaceFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1281
                defaultFont := matchingFamilyFaceFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1282
            ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1283
                matchingFamilyFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1284
                    defaultFont := matchingFamilyFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1285
                ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1286
                    matchingFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1287
                        defaultFont := matchingFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1288
                    ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1289
                ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1290
            ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1291
        ].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1292
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1293
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1294
    defaultFont isNil ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1295
        defaultFont isNil ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1296
            self warn:'Your display does not seem to provide any ' , newEncoding allBold , ' encoded font.\\Please select an appropriate font (iso10646-Unicode recommended)'.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1297
            pref := #'iso10646-1'.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1298
        ]
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1299
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1300
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1301
    msg := 'Switch to a %1 encoded font ?'.
3189
945a221e5cb2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3045
diff changeset
  1302
    (ask not or:[self confirm:(resources stringWithCRs:msg with:pref)])
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1303
    ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1304
        self withWaitCursorDo:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1305
            f := FontPanel
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1306
                    fontFromUserInitial:defaultFont
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1307
                    title:(resources string:'Font selection')
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1308
                    filter:filter
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1309
                    encoding:pref.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1310
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1311
            f notNil ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1312
                self font:f.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1313
            ]
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1314
        ]
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1315
    ]
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1316
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1317
    "Created: 26.10.1996 / 12:06:54 / cg"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1318
    "Modified: 30.6.1997 / 17:46:46 / cg"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1319
! !
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1320
2752
5650a9ab5935 method category rename
Claus Gittinger <cg@exept.de>
parents: 2744
diff changeset
  1321
!TextView methodsFor:'event handling'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1322
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1323
buttonMotion:buttonState x:x y:y
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1324
    "mouse-move while button was pressed - handle selection changes"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1325
3219
e8c7679a8a94 buttonrelease behavior, when released in another view
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
  1326
    (clickLine isNil or:[clickPos isNil]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1327
	dragIsActive := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1328
	^ self
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1329
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  1330
96256221e3af support drag
ca
parents: 2581
diff changeset
  1331
    dragIsActive ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1332
	(clickPos dist:(x@y)) >= 5.0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1333
	    dragIsActive := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1334
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1335
	    self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1336
		dropSource startDragIn:self at:(x@y)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1337
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1338
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1339
	^ self
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1340
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1341
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1342
    "is it the select or 1-button ?"
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1343
    buttonState == 0 ifTrue:[^ self].
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1344
    self sensor leftButtonPressed ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1345
	"/ self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1346
	"/ self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1347
	^ self
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1348
    ].
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1349
"/    (device buttonMotionMask:buttonState includesButton:#select) ifFalse:[
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1350
"/        (device buttonMotionMask:buttonState includesButton:1) ifFalse:[
1619
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1351
"/            ^ self
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1352
"/        ].
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1353
"/    ].
53
b587b15eafab *** empty log message ***
claus
parents: 45
diff changeset
  1354
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1355
    "if moved outside of view, start autoscroll"
3202
8217b0acc9f2 select from beginning (in editField
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
  1356
4160
a9c329c2784d changed: buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 4156
diff changeset
  1357
    ((y < 0) and:[firstLineShown ~~ 0]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1358
	self compressMotionEvents:false.
5094
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1359
        (self startAutoScrollUp:y negated) ifTrue:[
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1360
            ^ self
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1361
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1362
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1363
    (y > height) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1364
	self compressMotionEvents:false.
5128
787b617a99e5 Merged 52e9f87d45c8 and fcd696f9f401 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5085 5120
diff changeset
  1365
        (self startAutoScrollDown:(y - height)) ifTrue:[
5094
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1366
            ^ self
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1367
        ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1368
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  1369
    ((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1370
	self compressMotionEvents:false.
5094
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1371
        (self startAutoScrollLeft:x) ifTrue:[
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1372
            ^ self
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1373
        ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1374
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1375
    (x > width) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1376
	self compressMotionEvents:false.
5094
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1377
        (self startAutoScrollRight:(x - width)) ifTrue:[
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1378
            ^ self
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1379
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1380
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1381
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1382
    "move inside - stop autoscroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1383
    autoScrollBlock notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1384
	self stopScrollSelect
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1385
    ].
3220
246c5a3bfefa oops - leftover prints
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
  1386
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1387
    self extendSelectionToX:x y:y setPrimarySelection:false.
1619
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1388
4160
a9c329c2784d changed: buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 4156
diff changeset
  1389
    "Modified: / 08-08-2010 / 11:20:54 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1390
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1391
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1392
buttonMultiPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1393
    "multi-mouse-click - select word under pointer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1394
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1395
    (button == 1) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1396
	clickPos := x @ y.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1397
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1398
	"/ The searchAction is mantained until a cut/replace or a search with a user selection is done
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  1399
"/        self clearSearchAction.
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  1400
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1401
	clickCount notNil ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1402
	    clickCount := clickCount + 1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1403
	    (clickCount == 2) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1404
		self doubleClickX:x y:y
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1405
	    ] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1406
		(clickCount == 3) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1407
		    self tripleClickX:x y:y
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1408
		] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1409
		    (clickCount == 4) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1410
			self quadClickX:x y:y
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1411
		    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1412
		]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1413
	    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1414
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1415
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1416
	super buttonMultiPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1417
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1418
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1419
    "Modified: 11.9.1997 / 04:15:35 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1420
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1421
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1422
buttonPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1423
    "mouse-click - prepare for selection change"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1424
1308
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1425
    |sensor clickVisibleLine|
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1426
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1427
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1428
    sensor       := self sensor.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1429
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1430
    (button == 1) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1431
	sensor shiftDown ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1432
	    "mouse-click with shift - adding to selection"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1433
	    self extendSelectionToX:x y:y.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1434
	    ^ self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1435
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1436
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1437
	clickVisibleLine := self visibleLineOfY:y.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1438
	clickPos := x @ y.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1439
	clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1440
	clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1441
	clickStartLine := clickLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1442
	clickStartCol := clickCol.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1443
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1444
	(self canDrag
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1445
	and:[(self isInSelection:clickLine col:clickCol)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1446
	and:[UserPreferences current startTextDragWithControl not
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1447
	     or:[sensor ctrlDown]]]) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1448
	    dragIsActive := true
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1449
	] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1450
	    self unselect.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1451
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1452
	clickCount := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1453
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1454
	super buttonPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1455
    ]
813
7168eda47e3b Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 770
diff changeset
  1456
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1457
    "Modified: / 20.5.1999 / 17:02:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1458
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1459
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1460
buttonRelease:button x:x y:y
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1461
    "mouse- button release - turn off autoScroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1462
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1463
    (button == 1) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1464
	self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1465
	    self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1466
	    self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1467
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1468
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1469
	autoScrollBlock notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1470
	    self stopScrollSelect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1471
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1472
	dragIsActive ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1473
	    self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1474
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1475
	clickPos := nil.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1476
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1477
	super buttonRelease:button x:x y:y
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1478
    ].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1479
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1480
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1481
    "/ clickPos := clickLine := clickCol := nil.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1482
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1483
    "Modified: / 20.5.1999 / 17:14:23 / cg"
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1484
!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1485
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1486
doubleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1487
    "double-click - select word under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1488
3588
a70267e5b501 st80 behavior: also scan for matching single quote
Claus Gittinger <cg@exept.de>
parents: 3587
diff changeset
  1489
    |sel ch scanCh matchCol scanCol fwdScan fwdSelect|
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1490
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1491
    self selectWordAtX:x y:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1492
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1493
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1494
     special - if clicked on a parenthesis, select to matching
4702
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1495
     (must de before doing the ST80 stuff below)
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1496
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1497
    ((sel := self selection) size == 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1498
    and:[(sel := sel at:1) size == 1]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1499
	ch := sel at:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1500
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1501
	((self isOpeningParenthesis:ch)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1502
	or:[ (self isClosingParenthesis:ch) ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1503
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1504
		searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1505
		ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1506
			      |prevLine prevCol moveBack pos1|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1507
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1508
			      prevLine := firstLineShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1509
			      prevCol := viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1510
			      self selectFromLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1511
					   toLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1512
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1513
			      self sensor ctrlDown ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1514
				  "/ undo scroll operation ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1515
				  self withCursor:Cursor eye do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1516
				      |delayCount|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1517
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1518
				      moveBack := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1519
				      (self isClosingParenthesis:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1520
					   (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1521
					       moveBack := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1522
					   ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1523
				      ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1524
					   selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1525
					       self makeLineVisible:selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1526
					       moveBack := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1527
					   ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1528
				      ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1529
				      moveBack ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1530
					   delayCount  := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1531
					   pos1 := x@y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1532
					   self invalidateRepairNow:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1533
					   Delay waitForSeconds:MatchDelayTime.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1534
					   delayCount := delayCount + MatchDelayTime.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1535
					   [self sensor hasUserEventFor:self] whileFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1536
						Delay waitForSeconds:MatchDelayTime / 2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1537
						delayCount := delayCount + (MatchDelayTime / 2).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1538
						delayCount > 2 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1539
						    self cursor:Cursor eyeClosed.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1540
						].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1541
						delayCount >= 2.3 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1542
						    self cursor:Cursor eye.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1543
						    delayCount := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1544
						]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1545
					   ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1546
					   self scrollToLine:prevLine; scrollToCol:prevCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1547
				      ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1548
				  ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1549
			      ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1550
			      ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1551
			  ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1552
		ifNotFound:[self showNotFound]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1553
		onError:[self beep]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1554
		openingCharacters:((parenthesisSpecification at:#open) ", '([{'")
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1555
		closingCharacters:((parenthesisSpecification at:#close) ", ')]}'").
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1556
	    selectStyle := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1557
	]
4702
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1558
    ].
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1559
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1560
    (self st80SelectMode or:[ self sensor ctrlDown]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1561
	"/ st80 selects:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1562
	"/   - if clicked right after a parenthesis -> select to matching parenthesis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1563
	"/   - if clicked right after a quote -> select to matching quote (unless escaped ;-)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1564
	"/   - if clicked at beginning of the line  -> select that line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1565
	"/   - if clicked at the top of the text    -> select all
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1566
	"/ however, do none of the above, if clicked on a parenthesis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1567
	clickCol == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1568
	    clickLine == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1569
		self selectAll.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1570
		^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1571
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1572
	    self selectLineAtY:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1573
	    selectStyle := #line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1574
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1575
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1576
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1577
	matchCol := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1578
	"/ see what is to the left of that character ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1579
	clickCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1580
	    ch := self characterAtLine:clickLine col:clickCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1581
	    (self isOpeningParenthesis:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1582
		matchCol := clickCol - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1583
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1584
		('"''|' includes:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1585
		    scanCol := clickCol - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1586
		    fwdScan := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1587
		    scanCh := ch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1588
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1589
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1590
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1591
	fwdSelect := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1592
	(matchCol isNil and:[scanCol isNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1593
	    clickCol < (self listAt:clickLine) size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1594
		ch := self characterAtLine:clickLine col:clickCol+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1595
		(self isClosingParenthesis:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1596
		    matchCol := clickCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1597
		    fwdSelect := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1598
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1599
		    ('"''|' includes:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1600
			scanCol := clickCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1601
			fwdScan := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1602
			scanCh := ch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1603
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1604
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1605
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1606
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1607
	matchCol notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1608
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1609
		searchForMatchingParenthesisFromLine:clickLine col:matchCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1610
		ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1611
			  self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1612
				       toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1613
		ifNotFound:[self showNotFound]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1614
		onError:[self beep]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1615
		openingCharacters:((parenthesisSpecification at:#open) , '([{')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1616
		closingCharacters:((parenthesisSpecification at:#close) , ')]}').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1617
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1618
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1619
	scanCol notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1620
	    "/ if its an EOL comment, do it differently
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1621
	    ch := self characterAtLine:clickLine col:clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1622
	    ch == $/ ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1623
		self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1624
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1625
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1626
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1627
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1628
		scanFor:scanCh fromLine:clickLine col:scanCol forward:fwdScan
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1629
		ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1630
			    |selStart selEnd|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1631
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1632
			    fwdScan ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1633
				selStart := scanCol+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1634
				selEnd := col-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1635
			    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1636
				selStart := scanCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1637
				selEnd := col+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1638
			    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1639
			    self selectFromLine:clickLine col:selStart
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1640
				 toLine:line col:selEnd.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1641
			    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1642
			   ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1643
		ifNotFound:[self showNotFound].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1644
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1645
	]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1646
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1647
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1648
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1649
     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
  1650
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1651
    wordStartLine := selectionStartLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1652
    wordEndLine := selectionEndLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1653
    selectStyle == #wordLeft ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1654
	wordStartCol := selectionStartCol + 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1655
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1656
	wordStartCol := selectionStartCol.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1657
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1658
    selectStyle == #wordRight ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1659
	wordEndCol := selectionEndCol - 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1660
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1661
	wordEndCol := selectionEndCol
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1662
    ]
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1663
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  1664
    "Created: / 11-09-1997 / 04:12:55 / cg"
4255
9bf0cc2595a9 changed: #doubleClickX:y:
Claus Gittinger <cg@exept.de>
parents: 4254
diff changeset
  1665
    "Modified: / 14-06-2011 / 14:04:59 / cg"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1666
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1667
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1668
extendSelectionToX:x y:y
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1669
    "mouse-move while button was pressed - handle selection changes"
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1670
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1671
    self extendSelectionToX:x y:y setPrimarySelection:true
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1672
!
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1673
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1674
extendSelectionToX:x y:y setPrimarySelection:aBoolean
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1675
    "mouse-move while button was pressed - handle selection changes"
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1676
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1677
    |movedVisibleLine movedLine movedCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1678
     movedUp
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1679
     oldStartLine oldEndLine oldStartCol oldEndCol|
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1680
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1681
    movedVisibleLine := self visibleLineOfY:y.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1682
    movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1683
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1684
    (x < leftMargin) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1685
	movedCol := 0
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1686
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1687
	movedCol := self colOfX:x inVisibleLine:movedVisibleLine
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1688
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1689
    y < 0 ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1690
	movedCol := 0
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1691
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1692
    ((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1693
	selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1694
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1695
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1696
	(clickPos isNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1697
	or:[(clickPos x - x) abs < 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1698
	    and:[(clickPos y - y) abs < 3]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1699
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1700
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1701
	selectionStartLine := clickLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1702
	selectionStartCol := clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1703
	selectionEndLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1704
	selectionEndCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1705
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1706
	oldStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1707
	oldEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1708
	oldStartCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1709
	oldEndCol := selectionEndCol-1.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1710
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1711
	selectionStartLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1712
	    selectionStartLine := selectionEndLine := clickLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1713
	    selectionStartCol := selectionEndCol := clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1714
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1715
	oldStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1716
	oldEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1717
	oldStartCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1718
	oldEndCol := selectionEndCol.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1719
    ].
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1720
    oldEndLine isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1721
	oldEndLine := selectionEndLine ? clickLine ? movedLine.
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1722
    ].
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1723
    oldEndCol isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1724
	oldEndCol := selectionEndCol ? clickCol.
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1725
    ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1726
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1727
    "find out if we are before or after initial click"
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1728
    movedUp := false.
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1729
    clickStartLine isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1730
	clickStartLine := movedLine.
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1731
    ].
3505
cdb364dede3e extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
  1732
    clickStartCol isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1733
	clickStartCol := movedCol.
3505
cdb364dede3e extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
  1734
    ].
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1735
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1736
    (movedLine < clickStartLine) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1737
	movedUp := true
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1738
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1739
	(movedLine == clickStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1740
	    (movedCol < clickStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1741
		movedUp := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1742
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1743
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1744
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1745
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1746
    movedUp ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1747
	"change selectionStart"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1748
	selectionStartCol := movedCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1749
	selectionStartLine := movedLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1750
	selectionEndCol := clickStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1751
	selectionEndLine := clickStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1752
	selectStyle notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1753
	    selectionEndCol := wordEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1754
	    selectionEndLine := wordEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1755
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1756
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1757
	"change selectionEnd"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1758
	selectionEndCol := movedCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1759
	selectionEndLine := movedLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1760
	selectionStartCol := clickStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1761
	selectionStartLine := clickStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1762
	selectStyle notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1763
	    selectionStartCol := wordStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1764
	    selectionStartLine := wordStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1765
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1766
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1767
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1768
    selectionStartLine isNil ifTrue:[^ self].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1769
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1770
    (selectionStartCol == 0) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1771
	selectionStartCol := 1
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1772
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1773
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1774
    "
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1775
     if in word-select, just catch the rest of the word
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1776
    "
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1777
    (selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1778
	movedUp ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1779
	    selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1780
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1781
	    selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1782
	    selectionEndCol == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1783
		selectionEndLine := selectionEndLine + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1784
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1785
	].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1786
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1787
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1788
    selectStyle == #line ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1789
	movedUp ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1790
	    selectionStartCol := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1791
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1792
	    selectionEndCol := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1793
	    selectionEndLine := selectionEndLine + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1794
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1795
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1796
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1797
    self validateNewSelection.
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1798
    aBoolean ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1799
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1800
	self selectionChanged.
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1801
    ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1802
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  1803
    "/ The searchAction is mantained until a cut/replace or a search with a user selection is done
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  1804
"/    self clearSearchAction.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1805
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1806
    (oldStartLine == selectionStartLine) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1807
	(oldStartCol ~~ selectionStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1808
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1809
		redrawLine:oldStartLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1810
		      from:((selectionStartCol min:oldStartCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1811
			to:((selectionStartCol max:oldStartCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1812
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1813
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1814
	self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1815
	    redrawFromLine:(oldStartLine?selectionStartLine min:selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1816
			to:(oldStartLine?selectionStartLine max:selectionStartLine)
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1817
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1818
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1819
    (oldEndLine == selectionEndLine) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1820
	(oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1821
	    self redrawLine:oldEndLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1822
		       from:((selectionEndCol min:oldEndCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1823
			 to:((selectionEndCol max:oldEndCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1824
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1825
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1826
	selectionEndLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1827
	    selectionStartLine := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1828
	    self redraw.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1829
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1830
	    (selectionStartLine notNil) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1831
		self redrawFromLine:(oldEndLine min:selectionEndLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1832
				 to:(oldEndLine max:selectionEndLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1833
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1834
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1835
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1836
    clickLine := movedLine.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1837
    clickCol := movedCol
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1838
4234
65f202270d2c changed: #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 4178
diff changeset
  1839
    "Modified: / 05-04-2011 / 17:13:35 / cg"
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  1840
    "Modified: / 17-04-2012 / 21:00:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1841
!
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1842
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1843
keyPress:key x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1844
    "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
  1845
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1846
    <resource: #keyboard (#Find #Copy #FindNext #FindPrev #FindAgain
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1847
			  #GotoLine #SelectAll #SaveAs #Print
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1848
			  #'F*' #'f*' #ZoomIn #ZoomOut)>
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1849
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1850
    (key == #Find) ifTrue:[self search. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1851
    (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
  1852
    (key == #GotoLine) ifTrue:[self gotoLine. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1853
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1854
    (key == #FindNext) ifTrue:[self searchFwd. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1855
    (key == #FindPrev) ifTrue:[self searchBwd. ^self].
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1856
    (key == #FindAgain) ifTrue:[self searchAgainInSameDirection. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1857
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1858
    (key == #SelectAll) ifTrue:[self selectAll. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1859
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1860
    (key == #SaveAs)    ifTrue:[self save.    ^self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1861
    (key == #Print)     ifTrue:[self doPrint. ^self].
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  1862
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1863
    (key == #ZoomIn or:[key == #ZoomOut]) ifTrue:[ self fontLargerOrSmaller:(key == #ZoomIn) ].
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1864
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1865
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1866
     shift-Fn defines a key-sequence
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1867
     Fn       pastes that sequence
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1868
     cmd-Fn   performs a 'doIt' on the sequence (Workspaces only)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1869
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1870
     (see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1871
    "
1193
811135bbd017 Do not crash when typing simple keys.
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
  1872
    (key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1873
	(('[fF][0-9]' match:key)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1874
	or:['[fF][0-9][0-9]' match:key]) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1875
	    self sensor shiftDown ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1876
		UserPreferences current functionKeySequences
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1877
		    at:key put:(self selection)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1878
	    ].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1879
	    ^ self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1880
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1881
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1882
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1883
    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
  1884
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1885
    "Modified: / 18-04-1997 / 12:12:27 / stefan"
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1886
    "Modified: / 10-03-2012 / 09:40:01 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1887
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1888
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1889
mapped
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1890
    super mapped.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1891
    selectionFgColor := selectionFgColor onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1892
    selectionBgColor := selectionBgColor onDevice:self graphicsDevice.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1893
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1894
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1895
quadClickX:x y:y
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1896
    "quadrupleClick-click - select all"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1897
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1898
    self selectAll
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1899
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1900
    "Created: / 11.9.1997 / 04:15:24 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1901
    "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
  1902
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1903
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1904
tripleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1905
    "triple-click - select line under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1906
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1907
    self selectLineAtY:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1908
    selectStyle := #line
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1909
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1910
    "Created: 11.9.1997 / 04:13:37 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1911
! !
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1912
2120
1054ce5c8fe7 category change
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
  1913
!TextView methodsFor:'initialization & release'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1914
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1915
fetchDeviceResources
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1916
    "fetch device colors, to avoid reallocation at redraw time"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1917
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1918
    super fetchDeviceResources.
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1919
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1920
    selectionFgColor notNil ifTrue:[selectionFgColor := selectionFgColor onDevice:self graphicsDevice].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1921
    selectionBgColor notNil ifTrue:[selectionBgColor := selectionBgColor onDevice:self graphicsDevice].
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1922
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1923
    "Created: 14.1.1997 / 00:14:33 / cg"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1924
!
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1925
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1926
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1927
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1928
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1929
    super initStyle.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1930
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1931
    viewBackground := DefaultViewBackground.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1932
    selectionFgColor := DefaultSelectionForegroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1933
    selectionFgColor isNil ifTrue:[selectionFgColor := bgColor].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1934
    selectionBgColor := DefaultSelectionBackgroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1935
    selectionBgColor isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1936
	self graphicsDevice hasColors ifTrue:[
5099
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1937
            DefaultSelectionForegroundColor isNil ifTrue:[
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1938
                selectionFgColor := fgColor
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1939
            ].
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1940
            selectionBgColor := Color green
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1941
        ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1942
	    self graphicsDevice hasGrayscales ifTrue:[
5099
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1943
                DefaultSelectionForegroundColor isNil ifTrue:[
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1944
                    selectionFgColor := fgColor
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1945
                ].
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1946
                selectionBgColor := Color gray
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1947
            ] ifFalse:[
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1948
                selectionBgColor := fgColor
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1949
            ]
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1950
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1951
    ].
708
e8eb52699f90 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  1952
4321
4c8c94f6e1c6 comemnt in: #initStyle
az
parents: 4310
diff changeset
  1953
    "Modified: / 22-01-1997 / 11:57:53 / cg"
4c8c94f6e1c6 comemnt in: #initStyle
az
parents: 4310
diff changeset
  1954
    "Modified (comment): / 05-10-2011 / 15:50:45 / az"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1955
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1956
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1957
initialize
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1958
    super initialize.
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1959
    self initializeSaveAction.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1960
    contentsWasSaved := false.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1961
    dragIsActive     := false.
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  1962
    lastSearchWasMatch := lastSearchWasVariableSearch := false.
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  1963
    lastSearchIgnoredCase := true.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1964
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1965
    parenthesisSpecification isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1966
	parenthesisSpecification := DefaultParenthesisSpecification.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1967
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1968
911
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1969
    "I handle menus myself"
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1970
    menuHolder := menuPerformer := self.
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1971
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1972
    "/ on default allow drag
96256221e3af support drag
ca
parents: 2581
diff changeset
  1973
    self allowDrag:true.
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1974
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1975
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1976
initializeSaveAction
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1977
    saveAction := [ self openSaveDialog ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1978
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1979
4450
ef24b9b60ec1 category of:21 methods
Claus Gittinger <cg@exept.de>
parents: 4437
diff changeset
  1980
!TextView methodsFor:'menu & menu actions'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1981
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  1982
appendTo:aFileName
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1983
    "append contents to a file named fileName"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1984
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  1985
    |aStream msg filename|
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  1986
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  1987
    filename := aFileName asFilename.
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  1988
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  1989
    (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1990
	msg := resources string:'Refused to append to file ''%1'' !!' with:filename name.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1991
	self warn:(msg , '\\(ST/X internal permission check)' ) withCRs.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1992
	^ self
2036
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1993
    ].
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1994
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  1995
    [
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1996
	aStream := filename appendingWriteStream.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1997
	[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1998
	    self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1999
	] ensure:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2000
	    aStream close.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2001
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2002
	contentsWasSaved := true
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2003
    ] on:FileStream openErrorSignal do:[:ex|
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2004
	msg := resources string:'cannot append to file %1 !!' with:filename name.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2005
	self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2006
    ]
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2007
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2008
    "Modified: / 27-07-2012 / 09:41:18 / cg"
248
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
changeFont
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2012
    "pop up a fontPanel to change font"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2013
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2014
    |newFont fp|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2015
5005
2acadbbf1bce class: TextView
Claus Gittinger <cg@exept.de>
parents: 5004
diff changeset
  2016
    self withWaitCursorDo:[
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2017
        fp := FontPanel new.
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2018
        fp withChangeFontInViewsAllCheckBox:true.
5552
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5550 5547
diff changeset
  2019
        newFont := fp fontFromUserInitial:self font.
5005
2acadbbf1bce class: TextView
Claus Gittinger <cg@exept.de>
parents: 5004
diff changeset
  2020
    ].
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2021
    newFont notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2022
	self font:newFont.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2023
        fp changeFontInAllViews ifTrue:[
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2024
            "/ user checked this box - change the defaults,
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2025
            "/ and update all other textviews now.
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2026
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2027
            TextView defaultFont:newFont.
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2028
            UserPreferences current fontPreferences
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2029
                at:#Text put:(newFont storeString).
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2030
            DebugView newDebugger.
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2031
            TextView allSubInstances do:[:v |
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2032
                v font:newFont
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2033
            ].    
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2034
        ].    
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2035
    ]
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2036
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2037
    "Modified: 27.2.1996 / 00:53:51 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2038
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2039
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2040
copySelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2041
    "copy contents into smalltalk copybuffer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2042
863
ed4282df00a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
  2043
    |text|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2044
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2045
    text := self selection.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2046
    text notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2047
	self unselect.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2048
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2049
	"/ forget any emphasis ...
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2050
	text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2051
	self setClipboardText:text.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2052
    ]
649
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  2053
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  2054
    "Modified: 17.5.1996 / 08:57:54 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2055
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2056
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2057
defaultForGotoLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2058
    "return a default value to show in the gotoLine box"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2059
447
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2060
    ^ selectionStartLine
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2061
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2062
    "Modified: 1.3.1996 / 18:44:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2063
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2064
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2065
doPrint
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2066
    "print the contents on the printer"
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2067
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2068
    |printStream|
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2069
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2070
    list isNil ifTrue:[^ self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2071
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2072
    self withWaitCursorDo:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2073
	printStream := Printer new.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2074
	printStream supportsContext ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2075
	    printStream printerContext font:(self font).
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2076
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2077
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2078
	Printer writeErrorSignal handle:[:ex |
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2079
	    self warn:('error while printing:\\'
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2080
			, ex description
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2081
			, '\\(printing with: ' , (Printer printCommand) , ')') withCRs
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2082
	] do:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2083
	    self fileOutContentsOn:printStream.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2084
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2085
	printStream close
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2086
    ].
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2087
4363
4ed2feefc2c2 changed: #doPrint
Claus Gittinger <cg@exept.de>
parents: 4361
diff changeset
  2088
    "Created: / 06-05-1996 / 16:11:26 / cg"
4ed2feefc2c2 changed: #doPrint
Claus Gittinger <cg@exept.de>
parents: 4361
diff changeset
  2089
    "Modified: / 31-01-2012 / 18:16:39 / cg"
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2090
!
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2091
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2092
editMenu
1109
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  2093
    "return my popUpMenu"
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  2094
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  2095
    <resource: #keyboard (#Copy #Find #GotoLine #SaveAs #Print)>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  2096
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  2097
1545
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2098
    |items m|
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2099
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2100
    items := #(
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2101
			('Copy'          copySelection  Copy)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2102
			('-'             nil            )
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2103
			('Search...'     search         Find)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2104
			('Goto Line...'  gotoLine       GotoLine)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2105
			('-'             nil            )
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2106
			('Font...'       changeFont     )
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2107
			('-'             nil            )
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2108
			('Save As...'    save           SaveAs)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2109
			('Print'         doPrint        Print)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2110
		).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2111
1545
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2112
    m := PopUpMenu itemList:items resources:resources.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2113
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2114
    self hasSelectionForCopy ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2115
	m disable:#copySelection.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2116
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2117
    ^ m
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  2118
2458
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  2119
    "Modified: / 12.11.2001 / 13:43:56 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2120
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2121
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2122
find
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2123
    "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
  2124
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2125
    self search
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2126
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2127
    "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
  2128
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2129
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2130
fontLargerOrSmaller:largerBoolean
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2131
    |newFont|
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2132
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2133
    newFont := gc font asSize:(largerBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2134
			    ifTrue:[gc font size + 1]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2135
			    ifFalse:[(gc font size-1) max:4]).
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2136
    self font:newFont.
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2137
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2138
    "Modified: / 27-02-1996 / 00:53:51 / cg"
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2139
    "Created: / 10-03-2012 / 09:38:32 / cg"
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2140
!
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2141
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2142
gotoLine
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2143
    "show a box to enter lineNumber for positioning;
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2144
     The entered number may be prefixed by a + or -;
1926
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  2145
     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
  2146
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  2147
    |l lineNumberBox input lineToGo relative|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2148
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2149
    lineNumberBox :=
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2150
	EnterBox
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2151
	   title:(resources string:'Line number (or +/- relativeNr):')
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2152
	   okText:(resources string:'Goto')
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2153
	   abortText:(resources string:'Cancel')
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2154
	   action:[:l | input := l].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2155
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2156
    l := self defaultForGotoLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2157
    l notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2158
	l := l printString
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2159
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2160
    lineNumberBox initialText:l .
3394
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
  2161
    lineNumberBox label:(resources string:'Goto Line').
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2162
    lineNumberBox showAtPointer.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2163
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2164
    input size > 0 ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2165
	input := input withoutSpaces.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2166
	input size > 0 ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2167
	    (input startsWith:$+) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2168
		relative := 1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2169
	    ] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2170
		(input startsWith:$-) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2171
		    relative := -1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2172
		].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2173
	    ].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2174
	    relative notNil ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2175
		input := input copyFrom:2.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2176
	    ].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2177
	    lineToGo := Integer readFromString:input onError:nil.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2178
	    lineToGo notNil ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2179
		relative notNil ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2180
		    lineToGo := self currentLine + (lineToGo * relative)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2181
		].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2182
		self gotoLine:lineToGo
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2183
	    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2184
	]
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2185
    ].
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2186
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2187
    "Modified: / 17.5.1998 / 20:07:59 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2188
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2189
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2190
openSaveDialog
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2191
    "Ask user for filename using a fileSelectionBox
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2192
     and save contents into that file."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2193
2695
7e13db2802df better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
  2194
    Dialog
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2195
	requestSaveFileName:(resources string:'Save contents in:')
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2196
	default:defaultFileNameForFileDialog
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2197
	fromDirectory:directoryForFileDialog
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2198
	action:[:fileName | self saveAs:fileName]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2199
	appendAction:[:fileName | self appendTo:fileName]
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2200
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2201
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2202
openSearchBoxAndSearch
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2203
    "search for a string - show a box to enter searchpattern
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2204
     - currently no regular expressions are handled."
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2205
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2206
    "
4985
414cb5cbe48f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4885
diff changeset
  2207
     Q: is it a good idea to preserve the last searchstring between views?
414cb5cbe48f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4885
diff changeset
  2208
     cg: yes - turns out to be useful and less confusing than keeping last per view
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2209
    "
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2210
    |searchBox patternHolder caseHolder matchHolder matchWithRegexHolder wrapAtEndHolder
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2211
     fwd ign match initialString
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2212
     bindings bldr doSearch modal searchVariableHolder selectedVariable searchFullWordHolder
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2213
     replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2214
     searchAtBeginOfLineOnlyHolder|
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2215
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2216
    searchBarActionBlock notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2217
	self resetVariablesBeforeNewSearch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2218
	searchBarActionBlock value:#search value:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2219
	^ self
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2220
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2221
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2222
    modal := (UserPreferences current searchDialogIsModal).   "/ thats experimental
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2223
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2224
    ign := lastSearchIgnoredCase "? LastSearchIgnoredCase " ? true.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2225
    caseHolder := ign not asValue.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2226
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2227
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2228
    matchHolder := match asValue.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2229
    matchWithRegexHolder := (LastSearchWasMatchWithRegex ? false) asValue.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2230
    wrapAtEndHolder := (LastSearchWasWrapAtEndOfText ? false) asValue.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2231
    searchVariableHolder := (lastSearchWasVariableSearch ? false) asValue.
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2232
    searchFullWordHolder := false asValue.
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2233
    searchAtBeginOfLineOnlyHolder := false asValue.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2234
    replaceBooleanHolder := false asValue.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2235
    replaceTextHolder := '' asValue.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2236
    replaceBooleanEnabledHolder := self isReadOnly not asValue.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2237
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2238
    patternHolder := '' asValue.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2239
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2240
    self setSearchPatternWithMatchEscapes: match.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2241
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2242
    lastSearchPattern notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2243
	initialString := lastSearchPattern.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2244
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2245
"/  No longer force the current selection to be the initialString
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2246
"/    self hasSelectionWithinSingleLine ifTrue:[
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2247
"/        initialString := self selection asString.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2248
"/    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2249
    initialString isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2250
	LastSearchPatterns size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2251
	    initialString := LastSearchPatterns first.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2252
	]
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2253
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2254
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2255
    initialString notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2256
	patternHolder value:initialString.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2257
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2258
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2259
    fwd := true.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2260
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2261
    doSearch := [:fwd |
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2262
	|isVariableSearch pattern searchAction|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2263
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2264
	self resetVariablesBeforeNewSearch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2265
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2266
	isVariableSearch := self searchVariableVisible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2267
				and:[searchVariableHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2268
				and:[selectedVariable notNil]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2269
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2270
	isVariableSearch ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2271
	    searchAction := [self searchVariableWithSyntaxElement:selectedVariable forward:fwd].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2272
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2273
	    lastSearchWasVariableSearch := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2274
	    LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2275
	    LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2276
            LastSearchWasMatchWithRegex := matchWithRegexHolder value.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2277
            LastSearchWasWrapAtEndOfText := wrapAtEndHolder value.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2278
	    pattern := patternHolder value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2279
	    pattern notEmptyOrNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2280
		searchAction := [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2281
		    self searchUsingSpec:(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2282
			ListView::SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2283
			    pattern:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2284
			    ignoreCase:lastSearchIgnoredCase
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2285
                            match: lastSearchWasMatch 
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2286
                            regexMatch:matchWithRegexHolder value 
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2287
			    variable: searchVariableHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2288
			    fullWord: searchFullWordHolder value
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2289
                            forward:fwd
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2290
                            atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2291
                            wrapAtEnd:wrapAtEndHolder value).
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2292
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2293
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2294
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2295
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2296
	replaceBooleanHolder value ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2297
	    |selStart|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2298
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2299
	    isVariableSearch ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2300
		"/ must replace from the end towards beginning,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2301
		"/ because syntax-elements do not update their position, when
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2302
		"/ the text is changed (in replace).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2303
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2304
		selectedVariable := selectedVariable lastElementInChain.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2305
		self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2306
		searchAction := [selectedVariable := selectedVariable previousElement.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2307
				 selectedVariable notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2308
				     self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2309
				 ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2310
				 "/ self searchVariableWithSyntaxElement:selectedVariable forward:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2311
				].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2312
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2313
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2314
	    selStart := self characterPositionOfSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2315
	    self replace:(replaceTextHolder value).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2316
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2317
	    searchAction value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2318
	    [self characterPositionOfSelection ~= selStart] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2319
		selStart := self characterPositionOfSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2320
		self replace:(replaceTextHolder value).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2321
		searchAction value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2322
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2323
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2324
	    searchAction value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2325
	].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2326
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2327
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2328
    bindings := IdentityDictionary new.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2329
    bindings at:#searchPattern put:patternHolder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2330
    modal ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2331
	bindings at:#nextAction put:[searchBox doAccept.].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2332
	bindings at:#prevAction put:[fwd := false. searchBox doAccept.].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2333
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2334
	bindings at:#nextAction put:[doSearch value:true.  "searchBox doAccept."].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2335
	bindings at:#prevAction put:[doSearch value:false. "fwd := false. searchBox doAccept."].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2336
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2337
    bindings at:#caseSensitive put:caseHolder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2338
    bindings at:#match put:matchHolder.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2339
    bindings at:#matchWithRegex put:matchWithRegexHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2340
    Regex::RxMatcher isNil ifTrue:[
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2341
        bindings at:#matchWithRegexVisible put:false.
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2342
    ] ifFalse:[
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2343
        bindings at:#matchWithRegexVisible put:matchHolder
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2344
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2345
    bindings at:#patternList put:LastSearchPatterns.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2346
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2347
    self supportsSyntaxElements ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2348
	bindings at:#searchVariableVisible put:false.
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2349
    ] ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2350
	bindings at:#searchVariableVisible put:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2351
	selectedVariable := self syntaxElementForSelectedVariable.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2352
	bindings at:#searchVariableEnabled put:(selectedVariable notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2353
	selectedVariable notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2354
	    bindings
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2355
		at:#stringWithVariableUnderCursorHolder
5280
de11c20946ee class: TextView
Claus Gittinger <cg@exept.de>
parents: 5276
diff changeset
  2356
                put:(resources string:'Variable ("%1")' with:selectedVariable name).
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2357
            "/ searchVariableHolder value:true.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2358
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2359
	    bindings
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2360
		at:#stringWithVariableUnderCursorHolder
5262
1f4b4b257010 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5249
diff changeset
  2361
                put:(resources string:'Variable (none selected)').
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2362
	].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2363
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2364
    bindings at:#searchVariable put:searchVariableHolder.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2365
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2366
    bindings at:#searchFullWord put:searchFullWordHolder.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2367
    bindings at:#searchFullWordEnabled put:true.
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2368
    bindings at:#searchAtBeginOfLineOnly put:searchAtBeginOfLineOnlyHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2369
    bindings at:#wrapAtEndOfTextHolder put:wrapAtEndHolder.
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2370
    
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2371
    bindings at:#replaceEnabled put:replaceBooleanEnabledHolder.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2372
    bindings at:#replaceBoolean put:replaceBooleanHolder.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2373
    bindings at:#replaceTextHolder put:replaceTextHolder.
5010
ad4a10879e16 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5005
diff changeset
  2374
    replaceBooleanHolder onChangeEvaluate:
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2375
	[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2376
	    replaceBooleanHolder value ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2377
		(bldr componentAt:#ReplaceEntryField) requestFocus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2378
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2379
		(bldr componentAt:#patternComboBox) requestFocus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2380
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2381
	].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2382
    modal ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2383
	searchBox := SimpleDialog new.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2384
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2385
	searchBox := ApplicationModel new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2386
	searchBox createBuilder.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2387
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2388
    searchBox resources:(self resources).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2389
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2390
    bldr := searchBox builder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2391
    bldr addBindings:bindings.
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2392
    bldr aspectAt:#flyByHelpSpec put:(self class flyByHelpSpec).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2393
    searchBox allButOpenFrom:(self class searchDialogSpec).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2394
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2395
    (bldr componentAt:#nextButton) cursor:(Cursor thumbsUp).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2396
    (bldr componentAt:#prevButton) cursor:(Cursor thumbsUp).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2397
    (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2398
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2399
    modal ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2400
	searchBox openDialog.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2401
	searchBox accepted ifTrue:[ doSearch value:fwd ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2402
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2403
	(bldr componentAt:#nextButton) isReturnButton:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2404
	(bldr componentAt:#cancelButton)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2405
		label:(resources string:'Close');
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2406
		action:[searchBox closeRequest].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2407
	"/ searchBox masterApplication:self application.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2408
	self topView beMaster.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2409
	searchBox window
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2410
		beSlave;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2411
		openInGroup:(self windowGroup).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2412
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2413
	"/ searchBox window open.
5284
3a5b9fd35c8c class: TextView
Claus Gittinger <cg@exept.de>
parents: 5280
diff changeset
  2414
        searchBox window assignKeyboardFocusToFirstKeyboardConsumer.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2415
    ]
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2416
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2417
    "Modified: / 11-07-2006 / 11:18:38 / fm"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2418
    "Created: / 08-03-2012 / 14:02:59 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2419
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2420
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2421
save
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2422
    "save contents into a file
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2423
     - ask user for filename using a fileSelectionBox."
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2424
3201
ce84e272c6bb code cleanup
Claus Gittinger <cg@exept.de>
parents: 3189
diff changeset
  2425
    saveAction value
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2426
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2427
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2428
saveAs:fileName
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2429
    "save the contents into a file named fileName.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2430
     On error return false otherwise return true"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2431
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2432
    ^ self saveAs:fileName doAppend:false
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2433
!
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2434
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2435
saveAs:aFilename doAppend:doAppend
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2436
    "save the contents into a file named fileName;
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2437
     if doAppend is true, the view's contents is appended to the existing
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2438
     contents - otherwise, it overwrites any previous file contents.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2439
     On error return false otherwise return true"
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2440
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2441
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:true
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2442
!
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2443
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2444
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2445
    "save the contents into a file named fileName;
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2446
     if doAppend is true, the view's contents is appended to the existing
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2447
     contents - otherwise, it overwrites any previous file contents.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2448
     On error return false otherwise return true"
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2449
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2450
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:nil
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2451
!
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2452
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2453
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:eolMode
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2454
    "save the contents into a file named fileName;
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2455
     if doAppend is true, the view's contents is appended to the existing
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2456
     contents - otherwise, it overwrites any previous file contents.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2457
     eolMode is one of #cr, #nl or #crlf.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2458
     On error return false otherwise return true."
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2459
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2460
    |filename msg|
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2461
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2462
    filename := aFilename asFilename.
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2463
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2464
    self withWriteCursorDo:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2465
	|aStream|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2466
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2467
	(FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2468
	    msg := resources
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2469
			stringWithCRs:'Refused to write file ''%1'' !!\(ST/X internal permission check)'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2470
			with:filename name.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2471
	] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2472
	    [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2473
		doAppend ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2474
		    aStream := filename appendingWriteStream.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2475
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2476
		    aStream := filename newReadWriteStream.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2477
		].
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2478
                aStream eolMode:eolMode.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2479
		self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2480
		aStream syncData; close.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2481
		contentsWasSaved := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2482
		defaultFileNameForFileDialog := filename.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2483
	    ] on:FileStream openErrorSignal do:[:ex|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2484
		msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2485
				with:filename name
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2486
				with:FileStream lastErrorString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2487
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2488
	].
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2489
    ].
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2490
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2491
    msg notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2492
	Dialog warn:msg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2493
	^ false
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2494
    ].
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2495
    ^ true
916
4201c9c2a4f0 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  2496
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2497
    "Modified: / 27-07-2012 / 09:45:13 / cg"
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2498
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2499
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2500
search
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2501
    "search for a string - show a box to enter searchpattern
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2502
     - 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
  2503
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2504
    self openSearchBoxAndSearch
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2505
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2506
    "Modified: / 11-07-2006 / 11:18:38 / fm"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2507
    "Modified: / 08-03-2012 / 14:03:10 / cg"
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2508
!
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2509
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2510
search:patternArg ignoreCase:ign forward:fwd
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2511
    "search for a string without matching"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2512
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2513
    self search:patternArg ignoreCase:ign match: false forward:fwd
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2514
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2515
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2516
search:patternArg ignoreCase:ign match: match forward:fwd
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2517
    |pattern|
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2518
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2519
    pattern := patternArg string.
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2520
    pattern notEmpty ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2521
	self rememberSearchPattern:pattern.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2522
	"/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2523
	"/ LastSearchWasMatch := match.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2524
	fwd ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2525
	    lastSearchDirection := #backward.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2526
	    self searchBwd:pattern ignoreCase:ign match: match.          "    backward search with match is not yet available  "
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2527
	] ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2528
	    lastSearchDirection := #forward.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2529
	    self searchFwd:pattern ignoreCase:ign match: match.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2530
	]
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2531
    ]
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2532
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2533
    "Created: / 11-07-2006 / 11:18:04 / fm"
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  2534
    "Modified: / 23-03-2012 / 12:12:07 / cg"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2535
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2536
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2537
searchUsingSpec:aSearchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2538
    self rememberSearchPattern:(aSearchSpec pattern).
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2539
    "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2540
    "/ LastSearchWasMatch := match.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2541
    aSearchSpec forward ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2542
	lastSearchDirection := #backward.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2543
	self searchBwdUsingSpec:aSearchSpec
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2544
    ] ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2545
	lastSearchDirection := #forward.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2546
	self searchFwdUsingSpec:aSearchSpec
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2547
    ]
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2548
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2549
    "Created: / 11-07-2006 / 11:18:04 / fm"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2550
    "Modified: / 23-03-2012 / 12:12:07 / cg"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2551
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2552
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2553
searchVariableVisible
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2554
    "search variable option in searchbox visible?
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2555
     (only true for codeview2's textview)"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2556
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2557
    ^ false
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2558
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2559
    "Created: / 08-03-2012 / 14:01:24 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2560
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2561
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2562
searchVariableWithSyntaxElement:syntaxElementForVariable forward:fwd
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2563
    "this only works for CodeView2::TextView, which supports syntaxElements.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2564
     Finds the next occurrence of a syntax element (typically, a variable)"
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2565
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2566
    |el el2|
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2567
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2568
    lastSearchWasVariableSearch := true.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2569
    el := fwd
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2570
	ifTrue:[syntaxElementForVariable nextElement]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2571
	ifFalse:[syntaxElementForVariable previousElement].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2572
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2573
    el notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2574
	"bug workaround"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2575
	(el start = syntaxElementForVariable start) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2576
	    el2 := fwd
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2577
		ifTrue:[el nextElement]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2578
		ifFalse:[el previousElement].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2579
	    el2 notNil ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2580
		el := el2
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2581
	    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2582
	].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2583
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2584
    el notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2585
	self selectFromCharacterPosition:el start to:el stop.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2586
	self makeLineVisible:(self lineOfCharacterPosition:el start).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2587
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2588
	self showNotFound
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2589
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2590
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2591
    "Created: / 08-03-2012 / 14:08:20 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2592
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2593
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2594
syntaxElementForSelectedVariable
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2595
    "for a better search; ignored here, but redefined in CodeView2"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2596
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2597
    ^ nil
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2598
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2599
    "Created: / 08-03-2012 / 14:20:27 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2600
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2601
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2602
syntaxElementForVariableUnderCursor
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2603
    "for a better search; ignored here, but redefined in CodeView2"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2604
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2605
    ^ nil
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2606
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2607
    "Created: / 08-03-2012 / 12:45:26 / cg"
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
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2610
!TextView methodsFor:'native widget support'!
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2611
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2612
nativeWindowType
5128
787b617a99e5 Merged 52e9f87d45c8 and fcd696f9f401 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5085 5120
diff changeset
  2613
    "return a symbol describing my native window type
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2614
     (may be used internally by the device as a native window creation hint,
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2615
      if the device supports native windows)"
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2616
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2617
    ^ #TextView
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2618
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2619
    "Created: 2.5.1997 / 14:41:00 / cg"
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2620
! !
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2621
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2622
!TextView methodsFor:'private'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2623
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2624
currentSelectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2625
    ^  selectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2626
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2627
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2628
currentSelectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2629
    ^ selectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2630
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2631
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2632
fileOutContentsOn:aStream
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2633
    "save contents on a stream, replacing leading spaces by tab-characters."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2634
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2635
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2636
	fileOutContentsOn:aStream
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2637
	compressTabs:true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2638
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2639
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2640
fileOutContentsOn:aStream compressTabs:compressTabs
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2641
    "save contents on a stream. If compressTabs is true,
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2642
     leading spaces will be replaced by tab-characters in the output."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2643
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2644
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2645
	fileOutContentsOn:aStream
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2646
	compressTabs:compressTabs
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2647
	encoding:nil
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2648
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2649
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2650
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
  2651
    "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
  2652
     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
  2653
2877
cdaea8ccd364 encoding
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  2654
    |startNr nLines string encoder|
cdaea8ccd364 encoding
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  2655
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2656
    self removeTrailingWhitespace.
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2657
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2658
    encoder := CharacterEncoder encoderToEncodeFrom:gc characterEncoding into:encodingSymOrNil.
4455
febe97112d50 changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  2659
    encoder isNullEncoder ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2660
	(list contains:[:lineOrNil|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2661
			    |s|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2662
			    lineOrNil notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2663
			    and:[(s := lineOrNil string string) isWideString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2664
			    and:[s asSingleByteStringIfPossible isWideString]]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2665
		       ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2666
	) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2667
	    (Dialog confirm:'The text contains non-8bit characters. Encode as UTF8?') ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2668
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2669
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2670
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2671
	encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8
4455
febe97112d50 changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  2672
    ].
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  2673
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2674
    aStream isFileStream ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2675
	"on some systems, writing linewise is very slow (via NFS)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2676
	 therefore we convert to a string and write it in big chunks.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2677
	 To avoid creating huge strings, we do it in blocks of 1000 lines,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2678
	 limiting temporary string creation to about 50-80k.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2679
	"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2680
	startNr := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2681
	nLines := list size.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2682
        (aStream eolMode notNil
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2683
        and:[aStream eolMode ~= #nl]) ifTrue:[
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2684
            "/ must do it lineWise ...
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2685
            list do:[:line |
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2686
                line notNil ifTrue:[
5326
ef27d6e1ebcd class: TextView
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2687
                    encoder encodeString:line withTabs on:aStream
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2688
                ].
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2689
                aStream cr
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2690
            ].
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2691
        ] ifFalse:[
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2692
            [startNr <= nLines] whileTrue:[
5128
787b617a99e5 Merged 52e9f87d45c8 and fcd696f9f401 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5085 5120
diff changeset
  2693
                string := list
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2694
                            asStringWithCRsFrom:startNr
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2695
                            to:((startNr + 1000) min:nLines)
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2696
                            compressTabs:compressTabs.
5326
ef27d6e1ebcd class: TextView
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2697
                encoder encodeString:string string on:aStream.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2698
                startNr := startNr + 1000 + 1.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2699
            ].
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2700
        ].
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2701
    ] ifFalse:[
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2702
        list do:[:aLine |
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2703
            aLine notNil ifTrue:[
5326
ef27d6e1ebcd class: TextView
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2704
                encoder encodeString:aLine on:aStream.
ef27d6e1ebcd class: TextView
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2705
            ].
ef27d6e1ebcd class: TextView
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2706
            aStream cr.
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2707
        ]
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2708
    ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2709
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2710
    "Modified: 8.6.1996 / 11:50:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2711
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2712
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2713
getFontParameters
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2714
    "get some info of the used font. They are cached since we use them often ..
4779
9f7633fc5583 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4767
diff changeset
  2715
     This is redefined here, to use the font's maxHeight/maxAscent for
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2716
     line separation. This is required, to allow for proper handling of
4779
9f7633fc5583 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4767
diff changeset
  2717
     national characters, such as A-diaresis ..."
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2718
5444
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2719
    |italicFont boldFont currentDeviceFont |
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2720
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2721
    currentDeviceFont := gc createFontOnDevice.
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2722
    "/ do we really need this info now?
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2723
    "/ on unix, it seems to work with the next two lines commented;
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2724
    "/ should probably check on windows too
5444
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2725
    italicFont := currentDeviceFont asItalic onDevice:self device.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2726
    boldFont := currentDeviceFont asBold onDevice:self device.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2727
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2728
    fontHeight := currentDeviceFont height.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2729
    fontAscent := currentDeviceFont ascent. 
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2730
    fontWidth := currentDeviceFont width.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2731
    fontIsFixedWidth := currentDeviceFont isFixedWidth.
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2732
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2733
    "/ fA := font maxAscent. 
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2734
    italicFont notNil ifTrue:[ 
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2735
        fontHeight := fontHeight max:(italicFont height).
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2736
        fontAscent := fontAscent max:(italicFont ascent).
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2737
        fontIsFixedWidth := fontIsFixedWidth and:[ italicFont isFixedWidth ]
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2738
    ]. 
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2739
    boldFont notNil ifTrue:[ 
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2740
        fontHeight := fontHeight max:(boldFont height).
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2741
        fontAscent := fontAscent max:(boldFont ascent).
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2742
        fontIsFixedWidth := fontIsFixedWidth and:[ boldFont isFixedWidth ]
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2743
    ]. 
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2744
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2745
    includesNonStrings == true ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2746
	"/ for now, we do not support variable height entries ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2747
	fontHeight := fontHeight max:(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
  2748
    ].
4579
3a5a72358a0a class: TextView
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
  2749
    fontHeight := fontHeight + lineSpacing.
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2750
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2751
    "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
  2752
    "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
  2753
!
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2754
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2755
highlightLineSpacing
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2756
    "true if the spacing between lines is to be drawn with selected color,
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2757
     false if it remains white.
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2758
     false for selection in list views; true for edit/text views"
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2759
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2760
    ^ true
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2761
!
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2762
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2763
isClosingParenthesis:ch
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2764
    ((parenthesisSpecification at:#close) includes:ch) ifTrue:[^ true].
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2765
    ^ ')]}' includes:ch
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2766
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2767
    "Modified: / 12-02-2012 / 08:37:01 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2768
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2769
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2770
isOpeningParenthesis:ch
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2771
    ((parenthesisSpecification at:#open) includes:ch) ifTrue:[^ true].
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2772
    ^ '([{' includes:ch
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2773
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2774
    "Modified: / 12-02-2012 / 08:37:11 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2775
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2776
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2777
rememberSearchPattern:pattern
2691
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  2778
    |nRemembered patternString|
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  2779
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2780
    self clearSearchAction.
2813
ec8e83691849 forget searchAction, when a new pattern-search is done
Claus Gittinger <cg@exept.de>
parents: 2811
diff changeset
  2781
2691
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  2782
    patternString := pattern string.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2783
3270
e3ed37e15f9d oops - last-searchpatterns handling removed the wrong one.
Claus Gittinger <cg@exept.de>
parents: 3258
diff changeset
  2784
    nRemembered := NumRememberedSearchPatterns ? 20.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2785
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2786
    LastSearchPatterns isNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2787
	LastSearchPatterns := OrderedCollection new.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2788
    ].
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2789
    "/ move to top or addFirst
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2790
    (LastSearchPatterns includes:patternString) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2791
	LastSearchPatterns remove:patternString.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2792
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2793
	LastSearchPatterns size > nRemembered ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2794
	    LastSearchPatterns removeLast
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2795
	]
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2796
    ].
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2797
    LastSearchPatterns addFirst:patternString.
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2798
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2799
    "Modified: / 23-03-2012 / 13:59:09 / cg"
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2800
!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2801
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2802
removeTrailingWhitespace
3001
d9877eeb59f5 *** empty log message ***
ca
parents: 2992
diff changeset
  2803
    list isNil ifTrue:[^self].
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2804
    list keysAndValuesDo:[:lineNR :line |
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2805
	|l|
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2806
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2807
	line notNil ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2808
	    l := line withoutTrailingSeparators.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2809
	    list at:lineNR put:l.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2810
	]
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2811
    ].
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2812
!
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2813
4009
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2814
resetVariablesBeforeNewSearch
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2815
    "clear the autosearch action, when the first pattern is searched for"
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2816
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2817
    searchAction := nil.
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2818
!
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2819
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2820
scrollSelectDown
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2821
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2822
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2823
    |prevEndLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2824
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2825
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2826
    selectionEndLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2827
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2828
    self scrollDown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2829
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2830
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2831
    prevEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2832
    selectionEndLine := firstLineShown + nFullLinesShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2833
    selectionEndCol := 0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2834
    prevEndLine to:selectionEndLine do:[:lineNr |
5235
888c50995301 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5120
diff changeset
  2835
        self redrawLine:lineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2836
    ].
5235
888c50995301 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5120
diff changeset
  2837
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  2838
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2839
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2840
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2841
scrollSelectLeft
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2842
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2843
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2844
    |prevStartLine|
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
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2847
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2848
    selectionStartCol isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2849
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2850
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2851
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2852
    selectionStartCol := selectionStartCol - 1 max:1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2853
    self scrollLeft.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2854
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2855
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  2856
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2857
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2858
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2859
scrollSelectRight
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2860
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2861
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2862
    |prevEndCol firstVisibleCol endLine|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2863
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2864
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2865
    selectionEndCol isNil ifTrue:[^ self].
4169
11d3b7a3e713 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4160
diff changeset
  2866
    selectionEndLine isNil ifTrue:[^ self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2867
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2868
    prevEndCol := selectionEndCol.
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2869
    selectionEndCol := (selectionEndCol + 1) min:(self listAt:selectionEndLine) size.
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2870
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2871
    endLine := self listLineToVisibleLine:selectionEndLine.
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2872
    endLine notNil ifTrue:[
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2873
        firstVisibleCol := self colOfX:1 inVisibleLine:endLine.
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2874
        selectionEndCol < firstVisibleCol ifTrue:[
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2875
            "/ scrolling faster than selection advances...
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2876
            selectionEndCol := firstVisibleCol
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2877
        ].
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2878
    ].
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2879
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2880
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2881
    self scrollRight.
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2882
    "/ self repairDamage.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2883
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2884
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2885
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2886
    "Modified: / 05-08-2010 / 21:25:56 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2887
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2888
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2889
scrollSelectUp
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2890
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2891
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2892
    |prevStartLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2893
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2894
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2895
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2896
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2897
    self scrollUp.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2898
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2899
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2900
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2901
    selectionStartLine := firstLineShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2902
    selectionStartCol := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2903
    selectionStartLine to:prevStartLine do:[:lineNr |
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2904
        self redrawLine:lineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2905
    ].
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2906
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  2907
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2908
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2909
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2910
stopScrollSelect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2911
    "stop auto scroll; deinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2912
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2913
    autoScrollBlock notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2914
	Processor removeTimedBlock:autoScrollBlock.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2915
	self compressMotionEvents:true.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2916
	autoScrollBlock := nil.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2917
	autoScrollDeltaT := nil
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2918
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2919
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2920
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2921
textChanged
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2922
    self isNativeWidget ifTrue:[
5128
787b617a99e5 Merged 52e9f87d45c8 and fcd696f9f401 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5085 5120
diff changeset
  2923
        gc drawableId notNil ifTrue:[
787b617a99e5 Merged 52e9f87d45c8 and fcd696f9f401 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5085 5120
diff changeset
  2924
            gc device changeText:self contents in:gc drawableId
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2925
        ]
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2926
    ].
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2927
    super textChanged
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2928
!
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2929
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2930
widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2931
    "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
  2932
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2933
    selectionStartLine notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2934
	"/ if there is a selection which covers multiple lines,
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2935
	"/ we have to scroll the whole width (to include the selection-rectangle)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2936
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2937
	(lastLine < selectionStartLine) ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2938
	    (firstLine > selectionEndLine) ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2939
		^ width
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2940
	    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2941
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2942
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2943
    ^ super widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2944
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2945
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2946
!TextView methodsFor:'queries'!
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2947
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  2948
hasSearchActionSelection
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  2949
    "Here we fake the use of typeOfSelection which is really in EditTextView"
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  2950
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  2951
    ^ false
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  2952
!
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  2953
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2954
specClass
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2955
    "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
  2956
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2957
    self class == TextView ifTrue:[^ TextEditorSpec].
1046
10da5b6bd390 specClass query
ca
parents: 1028
diff changeset
  2958
    ^ super specClass
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2959
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2960
    "Modified: / 31.10.1997 / 19:48:35 / cg"
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2961
! !
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2962
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2963
!TextView methodsFor:'redrawing'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2964
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2965
clearMarginOfVisibleLine:visLine with:color
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2966
    "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
  2967
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2968
    (leftMargin ~~ 0) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2969
	viewOrigin x <= margin ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2970
	    self paint:color.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2971
	    self fillRectangleX:margin-viewOrigin x
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2972
			      y:(self yOfVisibleLine:visLine)- (lineSpacing//2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2973
			  width:leftMargin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2974
			 height:fontHeight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2975
	]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2976
    ]
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2977
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2978
    "Created: 6.3.1996 / 14:22:55 / cg"
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2979
!
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2980
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2981
drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2982
    startVisLineNr to:endVisLineNr do:[:visLine |
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2983
	self drawVisibleLineSelected:visLine
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2984
    ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2985
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2986
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2987
drawVisibleLineSelected:visLineNr
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2988
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2989
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2990
	inVisible:visLineNr
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2991
	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
  2992
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2993
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2994
drawVisibleLineSelected:visLineNr col:col
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2995
    self
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2996
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2997
	inVisible:visLineNr
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2998
	col:col
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2999
	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
  3000
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3001
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3002
drawVisibleLineSelected:visLineNr from:selectionStartCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3003
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3004
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3005
	inVisible:visLineNr
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3006
	from:selectionStartCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3007
	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
  3008
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3009
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3010
drawVisibleLineSelected:visLineNr from:startCol to:endCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3011
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3012
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3013
	inVisible:visLineNr
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3014
	from:startCol to:endCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3015
	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
  3016
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3017
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3018
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3019
    "redraw a visible line range"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3020
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3021
    |startLine endLine specialCare end selVisStart line1 line2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3022
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3023
    shown ifFalse:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3024
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3025
    end := endVisLineNr.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3026
    (end > nLinesShown) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3027
	end := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3028
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3029
2740
892dfb6b0da1 kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  3030
    selectionEndLine isNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3031
	selectionStartLine := nil
2740
892dfb6b0da1 kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  3032
    ].
2735
5ba2010aefa4 *** empty log message ***
penk
parents: 2730
diff changeset
  3033
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3034
    selectionStartLine isNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3035
	specialCare := false
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3036
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3037
	startLine := self visibleLineToAbsoluteLine:startVisLineNr.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3038
	(startLine > selectionEndLine) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3039
	    specialCare := false
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3040
	] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3041
	    endLine := self visibleLineToAbsoluteLine:end.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3042
	    (endLine < selectionStartLine) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3043
		specialCare := false
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3044
	    ] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3045
		specialCare := true
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3046
	    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3047
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3048
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3049
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3050
    "easy: nothing is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3051
    specialCare ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3052
	super redrawFromVisibleLine:startVisLineNr to:end.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3053
	^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3054
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3055
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3056
    "easy: all is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3057
    ((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3058
	self drawSelectedFromVisibleLine:startVisLineNr to:end.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3059
	^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3060
    ].
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
    (selectionStartLine >= firstLineShown) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3063
	"draw unselected top part"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3064
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3065
	selVisStart := self listLineToVisibleLine:selectionStartLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3066
	super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1).
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3067
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3068
	"and first partial selected line"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3069
	self redrawVisibleLine:selVisStart.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3070
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3071
	"rest starts after this one"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3072
	line1 := selVisStart + 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3073
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3074
	line1 := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3075
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3076
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3077
    (line1 > end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3078
    (line1 < startVisLineNr) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3079
	line1 := startVisLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3080
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3081
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3082
    "draw middle part of selection"
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
    (selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3085
	line2 := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3086
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3087
	line2 := (self listLineToVisibleLine:selectionEndLine) - 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3088
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3089
    (line2 > end) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3090
	line2 := end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3091
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3092
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3093
    self drawSelectedFromVisibleLine:line1 to:line2.
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
    (line2 >= end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3096
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3097
    "last line of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3098
    self redrawVisibleLine:(line2 + 1).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3099
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3100
    ((line2 + 2) <= end) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3101
	super redrawFromVisibleLine:(line2 + 2) to:end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3102
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3103
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3104
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3105
redrawVisibleLine:visLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3106
    "redraw visible line lineNr"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3107
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3108
    |line|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3109
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3110
    (selectionStartLine notNil and:[selectionEndLine notNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3111
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3112
	line := self visibleLineToAbsoluteLine:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3113
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3114
	    (line == selectionStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3115
		(line == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3116
		    "it's part-of-single-line selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3117
		    self clearMarginOfVisibleLine:visLineNr with:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3118
		    (selectionStartCol > 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3119
			super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3120
		    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3121
		    self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3122
		    super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3123
		    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3124
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3125
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3126
		"it's the first line of a multi-line selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3127
		(selectionStartCol ~~ 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3128
		    self clearMarginOfVisibleLine:visLineNr with:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3129
		    super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3130
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3131
		    viewOrigin x == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3132
			self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3133
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3134
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3135
		self drawVisibleLineSelected:visLineNr from:selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3136
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3137
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3138
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3139
	    (line == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3140
		"it's the last line of a multi-line selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3141
		(selectionEndCol == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3142
		    ^ super redrawVisibleLine:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3143
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3144
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3145
		self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3146
		self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3147
		super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3148
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3149
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3150
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3151
	    "it's a full line in a multi-line selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3152
	    self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3153
	    self drawVisibleLineSelected:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3154
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3155
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3156
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3157
    super redrawVisibleLine:visLineNr
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3158
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3159
    "Modified: 6.3.1996 / 14:22:19 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3160
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3161
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3162
redrawVisibleLine:visLine col:col
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3163
    "redraw single character at col in visible line lineNr."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3164
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3165
    |line|
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3166
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3167
    "/
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3168
    "/ care for selection
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3169
    "/
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3170
    (selectionStartLine notNil and:[selectionEndLine notNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3171
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3172
	line := self visibleLineToAbsoluteLine:visLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3173
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3174
	    ((line == selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3175
	    and: [col < selectionStartCol]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3176
		((line == selectionEndLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3177
		and: [col > selectionEndCol]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3178
		    "its in the selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3179
		    self drawVisibleLineSelected:visLine col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3180
		    ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3181
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3182
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3183
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3184
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3185
    self drawVisibleLine:visLine col:col with:fgColor and:bgColor
1496
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3186
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3187
    "Modified: / 22.4.1998 / 08:53:05 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3188
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3189
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3190
redrawVisibleLine:visLine from:startCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3191
    "redraw visible line lineNr from startCol to end of line"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3192
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3193
    |col line|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3194
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3195
    col := startCol.
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3196
    col == 0 ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3197
	col := 1.
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3198
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3199
2778
223915a2d6a4 kludge workaround selectionEndLine is sometimes nil
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  3200
    (selectionStartLine notNil and:[selectionEndLine notNil]) ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3201
	line := self visibleLineToAbsoluteLine:visLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3202
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3203
	    ((line == selectionStartLine)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3204
	     or:[line == selectionEndLine]) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3205
		"since I'm lazy, redraw full line"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3206
		self redrawVisibleLine:visLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3207
		^ self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3208
	    ].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3209
	    "the line is fully within the selection"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3210
	    self drawVisibleLineSelected:visLine from:col.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3211
	    ^ self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3212
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3213
    ].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3214
    super redrawVisibleLine:visLine from:col
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3215
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3216
    "Modified: 6.3.1996 / 14:19:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3217
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3218
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3219
redrawVisibleLine:visLine from:startCol to:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3220
    "redraw visible line lineNr from startCol to endCol"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3221
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3222
    |line allOut allIn leftCol rightCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3223
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3224
    line := self visibleLineToAbsoluteLine:visLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3225
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3226
    allIn := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3227
    allOut := false.
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3228
    (selectionStartLine isNil or:[selectionEndLine isNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3229
    or:[selectionStartCol isNil or:[selectionEndCol isNil]]]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3230
	allOut := true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3231
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3232
	(line between:selectionStartLine and:selectionEndLine) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3233
	    allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3234
	] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3235
	    (selectionStartLine == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3236
		((endCol < selectionStartCol)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3237
		or:[startCol > selectionEndCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3238
		    allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3239
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3240
		    ((startCol >= selectionStartCol)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3241
		    and:[endCol <= selectionEndCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3242
			allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3243
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3244
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3245
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3246
		(line == selectionStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3247
		    (endCol < selectionStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3248
			allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3249
		    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3250
			(startCol >= selectionStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3251
			    allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3252
			]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3253
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3254
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3255
		    (line == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3256
			(startCol > selectionEndCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3257
			    allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3258
			] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3259
			    (endCol <= selectionEndCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3260
				allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3261
			    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3262
			]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3263
		    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3264
			allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3265
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3266
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3267
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3268
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3269
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3270
    allOut ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3271
	super redrawVisibleLine:visLine from:startCol to:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3272
	^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3273
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3274
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3275
    allIn ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3276
	self drawVisibleLineSelected:visLine from:startCol to:endCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3277
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3278
	"redraw part before selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3279
	((line == selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3280
	 and:[startCol <= selectionStartCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3281
	    super redrawVisibleLine:visLine from:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3282
					      to:(selectionStartCol - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3283
	    leftCol := selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3284
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3285
	    leftCol := startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3286
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3287
	"redraw selected part"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3288
	(selectionEndLine > line) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3289
	    rightCol := endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3290
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3291
	    rightCol := selectionEndCol min:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3292
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3293
	self drawVisibleLineSelected:visLine from:leftCol to:rightCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3294
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3295
	"redraw part after selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3296
	(rightCol < endCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3297
	    super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3298
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3299
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3300
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3301
    "special care for first and last line of selection:
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3302
     must handle margin also"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3303
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3304
    ((line == selectionEndLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3305
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3306
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3307
    ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3308
	self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3309
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3310
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3311
    ((line == selectionStartLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3312
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3313
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3314
    ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3315
	self clearMarginOfVisibleLine:visLine with:bgColor.
4602
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3316
    ].
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3317
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3318
    ((line > selectionStartLine)
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3319
    and:[(startCol == 1)
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3320
    and:[selectionStartLine < selectionEndLine
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3321
    and:[line < selectionEndLine]]])
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3322
    ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3323
	self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3324
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3325
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3326
    "Modified: 6.3.1996 / 14:23:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3327
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3328
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3329
!TextView methodsFor:'searching'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3330
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3331
clearSearchAction
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3332
    searchAction := nil.
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3333
!
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3334
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3335
scanFor:aCharacter fromLine:startLine col:startCol forward:forward
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3336
		     ifFound:foundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3337
		  ifNotFound:notFoundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3338
    "search for a character in the direction given by forward.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3339
     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
  3340
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3341
    |lineString
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3342
     line   "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3343
     col    "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3344
     delta  "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3345
     endCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3346
     cc
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3347
     maxLine "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3348
      |
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3349
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3350
    col := startCol.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3351
    line := startLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3352
    forward ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3353
	delta := 1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3354
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3355
	delta := -1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3356
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3357
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3358
    lineString := list at:line.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3359
    maxLine := list size.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3360
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3361
    col := col + delta.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3362
    [true] whileTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3363
	lineString notNil ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3364
	    forward ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3365
		endCol := lineString size.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3366
	    ] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3367
		endCol := 1
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3368
	    ].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3369
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3370
	    col to:endCol by:delta do:[:rCol |
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3371
		cc := lineString at:rCol.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3372
		cc == aCharacter ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3373
		    ^ foundBlock value:line value:rCol.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3374
		]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3375
	    ].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3376
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3377
	line := line + delta.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3378
	(line < 1 or:[line > maxLine]) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3379
	    ^ notFoundBlock value
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3380
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3381
	lineString := list at:line.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3382
	forward ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3383
	    col := 1
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3384
	] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3385
	    col := lineString size
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3386
	]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3387
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3388
    "not reached"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3389
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3390
    "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
  3391
    "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
  3392
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3393
3802
sr
parents: 3792
diff changeset
  3394
searchAction
sr
parents: 3792
diff changeset
  3395
    ^ searchAction
sr
parents: 3792
diff changeset
  3396
!
sr
parents: 3792
diff changeset
  3397
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3398
searchAction:aSearcherOrSearchBlock
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3399
    searchAction := aSearcherOrSearchBlock
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3400
!
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3401
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3402
searchAgainInSameDirection
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3403
    "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
  3404
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3405
    |ign match|
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3406
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  3407
    searchBarActionBlock notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3408
	searchBarActionBlock value:#forward value:self.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3409
	^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3410
    ].
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3411
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3412
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3413
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3414
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3415
    self setSearchPatternWithMatchEscapes: match.
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3416
    lastSearchPattern notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3417
	lastSearchDirection == #backward ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3418
	    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3419
		searchBwd:lastSearchPattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3420
		ignoreCase:ign
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3421
		match: match
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3422
	] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3423
	    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3424
		searchFwd:lastSearchPattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3425
		ignoreCase:ign
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3426
		match: match
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3427
	]
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3428
    ]
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3429
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3430
    "Created: / 03-05-1999 / 15:02:16 / cg"
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3431
    "Modified: / 21-09-2006 / 16:47:57 / cg"
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3432
!
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3433
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3434
searchBwd
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3435
    "search backward (for the same thing again)
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3436
     If found, position cursor"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3437
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3438
    |ign selectedVariable|
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  3439
2811
3a7aed97fd76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  3440
    searchAction notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3441
	"/autosearch is cleared whenever there is search with user selection
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3442
	(self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
4178
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3443
    ].
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3444
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3445
    searchAction notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3446
	"/confusing: this is for autosearch of variables (browse variable uses, for example)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3447
	self searchUsingSearchAction:#backward.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3448
	^ self.
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3449
    ].
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  3450
    searchBarActionBlock notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3451
	searchBarActionBlock value:#backward value:self.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3452
	^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3453
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3454
    lastSearchWasVariableSearch ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3455
	selectedVariable := self syntaxElementForSelectedVariable.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3456
	selectedVariable notNil ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3457
	    self searchVariableWithSyntaxElement:selectedVariable forward:false.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3458
	    ^ self.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3459
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3460
	lastSearchWasVariableSearch := false.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3461
    ].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3462
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3463
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  3464
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3465
    self setSearchPatternWithMatchEscapes: false.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3466
    lastSearchPattern isNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3467
	LastSearchPatterns size > 0 ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3468
	    lastSearchPattern := LastSearchPatterns first
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3469
	]
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3470
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3471
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3472
    lastSearchPattern notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3473
	lastSearchDirection := #backward.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3474
	self rememberSearchPattern:lastSearchPattern.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3475
	self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3476
	    searchBwd:lastSearchPattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3477
	    ignoreCase:ign
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3478
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3479
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3480
    "Modified: / 08-03-2012 / 14:26:25 / cg"
248
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3483
searchBwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3484
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3485
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3486
    self searchBwd:pattern ifAbsent:[self showNotFound].
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3487
"/    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3488
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3489
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3490
    "Modified: / 21-09-2006 / 16:48:29 / 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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3493
searchBwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3494
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3495
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3496
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3497
	searchBwdUsingSpec:(ListView::SearchSpec new
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3498
					pattern:pattern)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3499
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3500
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3501
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3502
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3503
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3504
searchBwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3505
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3506
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3507
    self
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3508
	searchBwd:pattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3509
	ignoreCase:ign
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3510
	ifAbsent:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3511
		    self sensor compressKeyPressEventsWithKey:#FindPrev.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3512
		    self showNotFound
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3513
		 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3514
    "/ lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3515
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3516
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3517
    "Created: / 13-09-1997 / 06:18:00 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3518
    "Modified: / 23-03-2012 / 12:10:25 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3519
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3520
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3521
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3522
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3523
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3524
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3525
	searchBwdUsingSpec:(ListView::SearchSpec new
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3526
					pattern:pattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3527
					ignoreCase:ign)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3528
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3529
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3530
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3531
    "Created: 13.9.1997 / 06:18:41 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3532
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3533
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3534
searchBwd:pattern ignoreCase:ign match: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3535
    "do a backward search.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3536
    match pattern functionality is not yet available for backward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3537
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3538
    "/ lastSearchWasMatch := match.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3539
    self searchBwd:pattern ignoreCase:ign.
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3540
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3541
    "Modified: / 23-03-2012 / 12:12:44 / cg"
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3542
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3543
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3544
searchBwdUsingSpec:searchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3545
    "do a backward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3546
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3547
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3548
	searchBwdUsingSpec:searchSpec
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3549
	ifAbsent:[self showNotFound].
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3550
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3551
"/    lastSearchIgnoredCase := false.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3552
    lastSearchPattern := searchSpec pattern string
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3553
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3554
    "Modified: / 21-09-2006 / 16:48:29 / cg"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3555
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3556
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3557
searchBwdUsingSpec:searchSpec ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3558
    "do a backward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3559
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3560
    |pos startLine startCol|
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3561
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3562
    pos :=  self startPositionForSearchBackward.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3563
    startLine := pos y.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3564
    startCol := pos x.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3565
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3566
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3567
	searchBackwardUsingSpec:searchSpec
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3568
	startingAtLine:startLine col:startCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3569
	ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3570
	ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3571
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3572
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3573
searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3574
    "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
  3575
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3576
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3577
	searchForMatchingParenthesisFromLine:startLine col:startCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3578
	ifFound:[:line :col |
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3579
		  self selectFromLine:startLine col:startCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3580
			       toLine:line col:col]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3581
	ifNotFound:[self showNotFound]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3582
	onError:[self beep]
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3583
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3584
    "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
  3585
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3586
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3587
searchForMatchingParenthesisFromLine:startLine col:startCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3588
		     ifFound:foundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3589
		  ifNotFound:notFoundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3590
		     onError:failBlock
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3591
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3592
    "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
  3593
     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
  3594
     backwards if its a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3595
     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
  3596
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3597
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3598
    ^ self
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3599
	searchForMatchingParenthesisFromLine:startLine col:startCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3600
	ifFound:foundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3601
	ifNotFound:notFoundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3602
	onError:failBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3603
	ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' )
3478
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3604
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3605
    "Modified: / 12-04-2007 / 11:24:24 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3606
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3607
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3608
searchForMatchingParenthesisFromLine:startLine col:startCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3609
		     ifFound:foundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3610
		  ifNotFound:notFoundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3611
		     onError:failBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3612
		    ignoring:ignoreSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3613
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3614
    "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
  3615
     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
  3616
     backwards if its a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3617
     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
  3618
     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
  3619
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3620
    ^ self
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3621
	searchForMatchingParenthesisFromLine:startLine col:startCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3622
	ifFound:foundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3623
	ifNotFound:notFoundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3624
	onError:failBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3625
	openingCharacters: (parenthesisSpecification at:#open)  "/ #( $( $[ ${ "$> $<")
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3626
	closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<")
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3627
	ignoredCharacters: ignoreSet
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3628
	specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3629
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3630
"/    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3631
"/     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3632
"/     ignoring
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3633
"/     line   "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3634
"/     col    "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3635
"/     delta  "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3636
"/     endCol "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3637
"/     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3638
"/     cc prevCC nextCC incSet decSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3639
"/     nesting "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3640
"/     maxLine "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3641
"/     ign skip anySet|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3642
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3643
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3644
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3645
"/    parChar := self characterAtLine:startLine col:startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3646
"/    i := charSet indexOf:parChar.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3647
"/    i == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3648
"/        ^ failBlock value   "not a parenthesis"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3649
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3650
"/    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
  3651
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3652
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3653
"/    col := startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3654
"/    line := startLine.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3655
"/    direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3656
"/        delta := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3657
"/        incSet := #( $( $[ ${ "$<" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3658
"/        decSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3659
"/    ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3660
"/        delta := -1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3661
"/        incSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3662
"/        decSet := #( $( $[ ${ "$<" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3663
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3664
"/    anySet := Set new.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3665
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3666
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3667
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3668
"/    nesting := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3669
"/    ignoring := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3670
"/    lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3671
"/    maxLine := list size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3672
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3673
"/    col := col + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3674
"/    [nesting ~~ 0] whileTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3675
"/        (lineString notNil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3676
"/        and:[lineString includesAny:anySet]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3677
"/            direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3678
"/                endCol := lineString size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3679
"/            ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3680
"/                endCol := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3681
"/            ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3682
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3683
"/            col to:endCol by:delta do:[:rCol |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3684
"/                runCol := rCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3685
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3686
"/                cc := lineString at:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3687
"/                runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3688
"/                    nextCC := lineString at:runCol+1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3689
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3690
"/                    nextCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3691
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3692
"/                runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3693
"/                    prevCC := lineString at:runCol-1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3694
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3695
"/                    prevCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3696
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3697
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3698
"/                ign := skip := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3699
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3700
"/                "/ check for comments.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3701
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3702
"/                ((cc == $" and:[nextCC == $/])
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3703
"/                or:[prevCC == $$ ]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3704
"/                    "/ do nothing
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3705
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3706
"/                    skip := true.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3707
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3708
"/                    ignoreSet do:[:ignore |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3709
"/                        ignore == cc ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3710
"/                            ign := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3711
"/                        ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3712
"/                            ignore isString ifTrue:[
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3713
"/                                cc == (ignore at:2) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3714
"/                                    runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3715
"/                                        (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
  3716
"/                                            skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3717
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3718
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3719
"/                                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3720
"/                                    cc == (ignore at:1) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3721
"/                                        runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3722
"/                                            (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
  3723
"/                                                skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3724
"/                                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3725
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3726
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3727
"/                                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3728
"/                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3729
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3730
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3731
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3732
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3733
"/                ign ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3734
"/                    ignoring := ignoring not
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3735
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3736
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3737
"/                ignoring ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3738
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3739
"/                        (incSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3740
"/                            nesting := nesting + 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3741
"/                        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3742
"/                            (decSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3743
"/                                nesting := nesting - 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3744
"/                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3745
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3746
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3747
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3748
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3749
"/                nesting == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3750
"/                    "check if legal"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3751
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3752
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3753
"/                        cc == closingChar ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3754
"/                            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3755
"/                        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3756
"/                        ^ foundBlock value:line value:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3757
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3758
"/                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3759
"/            ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3760
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3761
"/        line := line + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3762
"/        (line < 1 or:[line > maxLine]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3763
"/            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3764
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3765
"/        lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3766
"/        direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3767
"/            col := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3768
"/        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3769
"/            col := lineString size
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3770
"/        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3771
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3772
"/    ^ notFoundBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3773
3478
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3774
    "Modified: / 12-04-2007 / 11:25:36 / cg"
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3775
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3776
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3777
searchForMatchingParenthesisFromLine:startLine col:startCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3778
		     ifFound:foundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3779
		  ifNotFound:notFoundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3780
		     onError:failBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3781
	   openingCharacters:openingCharacters
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3782
	   closingCharacters:closingCharacters
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3783
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3784
    "search for a matching parenthesis; start search with character at startLine/startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3785
     Search for the corresponding character is done forward if its an opening,
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3786
     backwards if its a closing parenthesis.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3787
     Evaluate foundBlock with line/col as argument if found, notFoundBlock if not.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3788
     If there is a nesting error, evaluate failBlock."
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3789
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3790
    ^ self
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3791
	searchForMatchingParenthesisFromLine:startLine col:startCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3792
	ifFound:foundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3793
	ifNotFound:notFoundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3794
	onError:failBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3795
	openingCharacters: openingCharacters
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3796
	closingCharacters: closingCharacters
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3797
	ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#())
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3798
	specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3799
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3800
"/    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3801
"/     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3802
"/     ignoring
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3803
"/     line   "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3804
"/     col    "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3805
"/     delta  "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3806
"/     endCol "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3807
"/     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3808
"/     cc prevCC nextCC incSet decSet
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3809
"/     nesting "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3810
"/     maxLine "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3811
"/     ign skip anySet|
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3812
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3813
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3814
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3815
"/    parChar := self characterAtLine:startLine col:startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3816
"/    i := charSet indexOf:parChar.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3817
"/    i == 0 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3818
"/        ^ failBlock value   "not a parenthesis"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3819
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3820
"/    direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3821
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3822
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3823
"/    col := startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3824
"/    line := startLine.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3825
"/    direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3826
"/        delta := 1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3827
"/        incSet := #( $( $[ ${ "$<" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3828
"/        decSet := #( $) $] $} "$>" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3829
"/    ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3830
"/        delta := -1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3831
"/        incSet := #( $) $] $} "$>" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3832
"/        decSet := #( $( $[ ${ "$<" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3833
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3834
"/    anySet := Set new.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3835
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3836
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3837
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3838
"/    nesting := 1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3839
"/    ignoring := false.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3840
"/    lineString := list at:line.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3841
"/    maxLine := list size.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3842
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3843
"/    col := col + delta.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3844
"/    [nesting ~~ 0] whileTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3845
"/        (lineString notNil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3846
"/        and:[lineString includesAny:anySet]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3847
"/            direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3848
"/                endCol := lineString size.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3849
"/            ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3850
"/                endCol := 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3851
"/            ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3852
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3853
"/            col to:endCol by:delta do:[:rCol |
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3854
"/                runCol := rCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3855
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3856
"/                cc := lineString at:runCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3857
"/                runCol < lineString size ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3858
"/                    nextCC := lineString at:runCol+1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3859
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3860
"/                    nextCC := nil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3861
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3862
"/                runCol > 1 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3863
"/                    prevCC := lineString at:runCol-1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3864
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3865
"/                    prevCC := nil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3866
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3867
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3868
"/                ign := skip := false.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3869
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3870
"/                "/ check for comments.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3871
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3872
"/                ((cc == $" and:[nextCC == $/])
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3873
"/                or:[prevCC == $$ ]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3874
"/                    "/ do nothing
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3875
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3876
"/                    skip := true.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3877
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3878
"/                    ignoreSet do:[:ignore |
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3879
"/                        ignore == cc ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3880
"/                            ign := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3881
"/                        ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3882
"/                            ignore isString ifTrue:[
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3883
"/                                cc == (ignore at:2) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3884
"/                                    runCol > 1 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3885
"/                                        (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3886
"/                                            skip := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3887
"/                                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3888
"/                                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3889
"/                                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3890
"/                                    cc == (ignore at:1) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3891
"/                                        runCol < lineString size ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3892
"/                                            (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3893
"/                                                skip := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3894
"/                                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3895
"/                                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3896
"/                                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3897
"/                                ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3898
"/                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3899
"/                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3900
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3901
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3902
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3903
"/                ign ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3904
"/                    ignoring := ignoring not
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3905
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3906
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3907
"/                ignoring ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3908
"/                    skip ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3909
"/                        (incSet includes:cc) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3910
"/                            nesting := nesting + 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3911
"/                        ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3912
"/                            (decSet includes:cc) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3913
"/                                nesting := nesting - 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3914
"/                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3915
"/                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3916
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3917
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3918
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3919
"/                nesting == 0 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3920
"/                    "check if legal"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3921
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3922
"/                    skip ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3923
"/                        cc == closingChar ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3924
"/                            ^ failBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3925
"/                        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3926
"/                        ^ foundBlock value:line value:runCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3927
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3928
"/                ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3929
"/            ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3930
"/        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3931
"/        line := line + delta.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3932
"/        (line < 1 or:[line > maxLine]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3933
"/            ^ failBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3934
"/        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3935
"/        lineString := list at:line.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3936
"/        direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3937
"/            col := 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3938
"/        ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3939
"/            col := lineString size
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3940
"/        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3941
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3942
"/    ^ notFoundBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3943
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3944
    "Modified: / 12-04-2007 / 11:25:36 / cg"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3945
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3946
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3947
searchForMatchingParenthesisFromLine:startLine col:startCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3948
		     ifFound:foundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3949
		  ifNotFound:notFoundBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3950
		     onError:failBlock
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3951
	   openingCharacters:openingCharacters
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3952
	   closingCharacters:closingCharacters
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3953
	   ignoredCharacters:ignoreSet
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3954
	  specialEOLComment:eolCommentSequence
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3955
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3956
    "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
  3957
     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
  3958
     backwards if its a closing parenthesis.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3959
     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
  3960
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3961
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3962
    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3963
     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3964
     ignoring
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  3965
     line   "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  3966
     col    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  3967
     delta  "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  3968
     endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  3969
     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3970
     cc prevCC nextCC incSet decSet
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  3971
     nesting "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  3972
     maxLine "{ Class: SmallInteger }"
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3973
     ign skip anySet
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3974
     eol1 eol2|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3975
2772
4e04a3bf399f check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3976
    self assert:(openingCharacters size == closingCharacters size).
4e04a3bf399f check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3977
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3978
    charSet := openingCharacters , closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3979
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3980
    parChar := self characterAtLine:startLine col:startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3981
    i := charSet indexOf:parChar.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3982
    i == 0 ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3983
	^ failBlock value   "not a parenthesis"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3984
    ].
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3985
3858
1fd3e63fb456 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3851
diff changeset
  3986
    direction := (i <= openingCharacters size) ifTrue:[#fwd] ifFalse:[#bwd].
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3987
    closingChar := (closingCharacters , openingCharacters) at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3988
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3989
    eol1 := eolCommentSequence at:1 ifAbsent:nil.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3990
    eol2 := eolCommentSequence at:2 ifAbsent:nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3991
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3992
    col := startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3993
    line := startLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3994
    direction == #fwd ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3995
	delta := 1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3996
	incSet := openingCharacters.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3997
	decSet := closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3998
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3999
	delta := -1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4000
	incSet := closingCharacters.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4001
	decSet := openingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4002
    ].
1454
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4003
    anySet := Set new.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4004
    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4005
    anySet := (anySet select:[:c | c isCharacter]) asString.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4006
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4007
    nesting := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4008
    ignoring := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4009
    lineString := list at:line.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4010
    maxLine := list size.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4011
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4012
    col := col + delta.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4013
    [nesting ~~ 0] whileTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4014
	(lineString notNil
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4015
	and:[lineString includesAny:anySet]) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4016
	    direction == #fwd ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4017
		endCol := lineString size.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4018
	    ] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4019
		endCol := 1
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4020
	    ].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4021
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4022
	    col to:endCol by:delta do:[:rCol |
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4023
		runCol := rCol.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4024
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4025
		cc := lineString at:runCol.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4026
		runCol < lineString size ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4027
		    nextCC := lineString at:runCol+1
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4028
		] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4029
		    nextCC := nil
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4030
		].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4031
		runCol > 1 ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4032
		    prevCC := lineString at:runCol-1
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4033
		] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4034
		    prevCC := nil
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4035
		].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4036
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4037
		ign := skip := false.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4038
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4039
		"/ check for comments.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4040
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4041
		((cc == eol1 and:[nextCC == eol2])
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4042
		or:[prevCC == $$ ]) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4043
		    "/ do nothing
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4044
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4045
		    skip := true.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4046
		] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4047
		    ignoreSet do:[:ignore |
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4048
			ignore == cc ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4049
			    ign := true
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4050
			] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4051
			    ignore isString ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4052
				cc == (ignore at:2) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4053
				    runCol > 1 ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4054
					(lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4055
					    skip := true
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4056
					]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4057
				    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4058
				] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4059
				    cc == (ignore at:1) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4060
					runCol < lineString size ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4061
					    (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4062
						skip := true
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4063
					    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4064
					]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4065
				    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4066
				]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4067
			    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4068
			]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4069
		    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4070
		].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4071
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4072
		ign ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4073
		    ignoring := ignoring not
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4074
		].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4075
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4076
		ignoring ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4077
		    skip ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4078
			(incSet includes:cc) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4079
			    nesting := nesting + 1
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4080
			] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4081
			    (decSet includes:cc) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4082
				nesting := nesting - 1
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4083
			    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4084
			]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4085
		    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4086
		].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4087
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4088
		nesting == 0 ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4089
		    "check if legal"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4090
		    skip ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4091
			cc == closingChar ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4092
			    ^ failBlock value
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4093
			].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4094
			^ foundBlock value:line value:runCol.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4095
		    ]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4096
		]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4097
	    ].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4098
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4099
	line := line + delta.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4100
	(line < 1 or:[line > maxLine]) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4101
	    ^ failBlock value
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4102
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4103
	lineString := list at:line.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4104
	direction == #fwd ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4105
	    col := 1
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4106
	] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4107
	    col := lineString size
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4108
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4109
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4110
    ^ notFoundBlock value
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4111
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  4112
    "Modified: 15.10.1996 / 12:22:30 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4113
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4114
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4115
searchFwd
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4116
    "search forward for the same pattern or selection again"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4117
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4118
    |ign match variable|
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  4119
2811
3a7aed97fd76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  4120
    searchAction notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4121
	"/ autosearch is cleared whenever there is search with user selection
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4122
	(self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
4177
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4123
    ].
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4124
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4125
    searchAction notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4126
	"/ confusing: this is for autosearch of variables (browse variable uses, for example)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4127
	self searchUsingSearchAction:#forward.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4128
	^ self.
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4129
    ].
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  4130
    searchBarActionBlock notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4131
	searchBarActionBlock value:#forward value:self.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4132
	^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4133
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4134
    lastSearchWasVariableSearch ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4135
	variable := self syntaxElementForSelectedVariable.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4136
	variable notNil ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4137
	    self searchVariableWithSyntaxElement:variable forward:true.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4138
	    ^ self.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4139
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4140
	lastSearchWasVariableSearch := false.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4141
    ].
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4142
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4143
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4144
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  4145
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4146
    selectStyle == #wordLeft ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4147
	"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4148
	 remove the space from the selection
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4149
	"
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4150
	selectionStartCol := selectionStartCol + 1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4151
	super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4152
	selectStyle := #word.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4153
	self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4154
    ].
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4155
    self setSearchPatternWithMatchEscapes: match.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4156
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4157
    lastSearchPattern isNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4158
	LastSearchPatterns size > 0 ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4159
	    lastSearchPattern := LastSearchPatterns first
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4160
	]
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4161
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4162
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4163
    lastSearchPattern notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4164
	self rememberSearchPattern:lastSearchPattern.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4165
	lastSearchDirection := #forward.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4166
	self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4167
	    searchFwd:lastSearchPattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4168
	    ignoreCase:ign
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4169
	    match: match
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4170
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4171
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4172
    "Modified: / 08-03-2012 / 14:25:42 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4173
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4174
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4175
searchFwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4176
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4177
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4178
    self searchFwd:pattern ifAbsent:[self showNotFound].
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4179
"/    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4180
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4181
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4182
    "Modified: / 21-09-2006 / 16:52:04 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4183
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4184
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4185
searchFwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4186
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4187
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4188
    self
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4189
	searchFwdUsingSpec:(ListView::SearchSpec new
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4190
				pattern:pattern)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4191
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4192
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4193
    "Modified: / 21-09-2006 / 16:51:28 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4194
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4195
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4196
searchFwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4197
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4198
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4199
    self
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4200
	searchFwdUsingSpec:(ListView::SearchSpec new
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4201
				pattern:pattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4202
				ignoreCase:ign)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4203
	ifAbsent:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4204
		    self sensor compressKeyPressEventsWithKey:#FindNext.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4205
		    self showNotFound
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4206
		 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4207
    "/ lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4208
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4209
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4210
    "Created: / 13-09-1997 / 06:18:13 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4211
    "Modified: / 23-03-2012 / 12:09:59 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4212
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4213
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4214
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4215
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4216
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4217
    self
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4218
	searchFwdUsingSpec:(ListView::SearchSpec new
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4219
				pattern:pattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4220
				ignoreCase:ign)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4221
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4222
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4223
    "Modified: 13.9.1997 / 01:05:35 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4224
    "Created: 13.9.1997 / 06:18:27 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4225
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4226
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4227
searchFwd:pattern ignoreCase:ign match: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4228
    "do a forward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4229
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4230
    self
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4231
	searchFwdUsingSpec:(ListView::SearchSpec new
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4232
				pattern:pattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4233
				ignoreCase:ign
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4234
				match:match)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4235
	ifAbsent:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4236
		    self sensor compressKeyPressEventsWithKey:#FindNext.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4237
		    self showNotFound
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4238
		 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4239
    "/ lastSearchIgnoredCase := ign.
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4240
    "/ lastSearchWasMatch := match.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4241
    lastSearchPattern := pattern string
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4242
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4243
    "Created: / 13-09-1997 / 06:18:13 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4244
    "Modified: / 23-03-2012 / 12:12:47 / cg"
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4245
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4246
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4247
searchFwd:pattern ignoreCase:ign match: match ifAbsent:aBlock
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4248
    "do a forward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4249
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4250
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4251
	searchFwdUsingSpec:(ListView::SearchSpec new
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4252
				pattern:pattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4253
				ignoreCase:ign
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4254
				match:match)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4255
	ifAbsent:aBlock
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4256
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4257
    "Modified: 13.9.1997 / 01:05:35 / cg"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4258
    "Created: 13.9.1997 / 06:18:27 / cg"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4259
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4260
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4261
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4262
    "do a forward search"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4263
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4264
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4265
	searchFwdUsingSpec:(ListView::SearchSpec new
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4266
				pattern:pattern
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4267
				ignoreCase:ign
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4268
				match:match)
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4269
	startingAtLine:startLine col:startCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4270
	ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4271
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4272
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4273
searchFwdUsingSpec:searchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4274
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4275
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4276
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4277
	searchFwdUsingSpec:searchSpec
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4278
	ifAbsent:[self showNotFound].
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4279
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4280
"/    lastSearchIgnoredCase := false.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4281
    lastSearchPattern := searchSpec pattern string
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4282
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4283
    "Modified: / 21-09-2006 / 16:52:04 / cg"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4284
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4285
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4286
searchFwdUsingSpec:searchSpec ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4287
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4288
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4289
    |pos startLine startCol|
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4290
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4291
    pos := self startPositionForSearchForward.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4292
    startLine := pos y.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4293
    startCol := pos x.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4294
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4295
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4296
	searchFwdUsingSpec:searchSpec
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4297
	startingAtLine:startLine col:startCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4298
	ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4299
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4300
    "Modified: 13.9.1997 / 01:05:35 / cg"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4301
    "Created: 13.9.1997 / 06:18:27 / cg"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4302
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4303
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4304
searchFwdUsingSpec:searchSpec startingAtLine:startLine col:startCol ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4305
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4306
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4307
    self
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  4308
        searchForwardUsingSpec:searchSpec
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  4309
        startingAtLine:startLine col:startCol
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  4310
        ifFound:[:line :col | 
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  4311
            self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  4312
        ]
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  4313
        ifAbsent:aBlock
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4314
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4315
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4316
searchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4317
    "return the last search pattern"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4318
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4319
    ^ lastSearchPattern
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4320
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4321
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4322
searchUsingSearchAction:direction
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4323
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4324
	searchUsingSearchAction:direction
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4325
	ifAbsent:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4326
		    self sensor compressKeyPressEventsWithKey:#FindNext.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4327
		    self showNotFound
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4328
		 ]
2816
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4329
!
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4330
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4331
searchUsingSearchAction:direction ifAbsent:notFoundAction
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4332
    |pos startLine startCol|
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4333
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4334
    pos :=  direction == #backward
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4335
		ifTrue:[self startPositionForSearchBackward]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4336
		ifFalse:[self startPositionForSearchForward].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4337
    startLine := pos y.
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4338
    startCol := pos x.
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4339
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4340
    searchAction notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4341
	searchAction
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4342
	    value:direction
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4343
	    value:startLine
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4344
	    value:startCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4345
	    value:[:line :col | self selectFromLine:line toLine:line]
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4346
	    value:notFoundAction.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4347
	self hasSelection ifTrue: [
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4348
	    self changeTypeOfSelectionTo: #searchAction.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4349
	].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4350
    ].
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4351
!
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4352
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4353
setSearchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4354
    "set the searchpattern from the selection if there is one"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4355
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4356
    self setSearchPatternWithMatchEscapes: false.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4357
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4358
3904
dd4c2dace4f5 changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents: 3892
diff changeset
  4359
setSearchPattern:aStringOrNil
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4360
    "set the searchpattern for future searches"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4361
3904
dd4c2dace4f5 changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents: 3892
diff changeset
  4362
    aStringOrNil isEmptyOrNil ifTrue:[
5247
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
  4363
        lastSearchPattern := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4364
    ] ifFalse:[
5247
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
  4365
        "/ not withoutSeparators: may want to search for spaces...
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
  4366
        lastSearchPattern := aStringOrNil asString "withoutSeparators" string.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4367
    ].
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4368
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4369
    "Modified: / 6.3.1999 / 23:47:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4370
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4371
2200
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4372
setSearchPattern:aString ignoreCase:aBoolean
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4373
    "set the searchpattern and caseIgnore for future searches"
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4374
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4375
    self setSearchPattern:aString.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4376
    lastSearchIgnoredCase := aBoolean.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4377
!
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4378
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4379
setSearchPatternWithMatchEscapes: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4380
    "set the searchpattern from the selection if there is one"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4381
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4382
    |sel searchPattern |
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4383
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4384
"/    clickPos isNil ifTrue:[^ self].
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4385
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4386
    sel := self selection.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4387
    sel notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4388
	searchPattern := sel asString.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4389
	match ifTrue:[searchPattern := searchPattern withMatchEscapes].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4390
	self setSearchPattern:searchPattern.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4391
    ]
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4392
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4393
    "Modified: / 6.3.1999 / 23:48:04 / cg"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4394
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4395
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4396
showMatch:pattern atLine:line col:col
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4397
    "after a search, highlight the matched pattern.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4398
     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
  4399
     (for now, it only highlights simple patterns and '*string*' correctly)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4400
4120
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4401
    self showMatch:pattern isMatch:true atLine:line col:col
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4402
!
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4403
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4404
showMatch:pattern isMatch:isMatch atLine:line col:col
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4405
    "after a search, highlight the matched pattern.
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4406
     The code below needs a rewrite to take care of match-characters
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4407
     (for now, it only highlights simple patterns and '*string*' correctly)"
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4408
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4409
    |realPattern|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4410
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4411
    realPattern := pattern.
4120
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4412
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4413
    isMatch ifTrue: [
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4414
	(realPattern startsWith:$*) ifTrue:[
5093
f69d248e1db0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5092
diff changeset
  4415
            realPattern := realPattern copyButFirst
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4416
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4417
	(realPattern endsWith:$*) ifTrue:[
5092
0108089c6550 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5078
diff changeset
  4418
            realPattern := realPattern copyButLast
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4419
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4420
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4421
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4422
    self selectFromLine:line col:col
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4423
		 toLine:line col:(col + realPattern size - 1).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4424
    self makeLineVisible:line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4425
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4426
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4427
showNotFound
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4428
    "search not found - tell user by beeping and changing
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4429
     cursor for a while (sometimes I work with a headset :-)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4430
     (used to be: tell user by changing cursor for a while)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4431
5052
70780a6ab673 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5046
diff changeset
  4432
    self withCursor:(Cursor cross) do:[
70780a6ab673 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5046
diff changeset
  4433
        self beep.
70780a6ab673 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5046
diff changeset
  4434
        Processor activeProcess millisecondDelay:200.
1028
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4435
    ]
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4436
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4437
    "Modified: 20.2.1997 / 12:49:27 / cg"
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4438
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4439
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4440
startPositionForSearchBackward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4441
    ^ self startPositionForSearchBackwardBasedOnSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4442
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4443
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4444
startPositionForSearchBackwardBasedOnSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4445
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4446
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4447
    selectionStartLine notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4448
	startLine := selectionStartLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4449
	startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4450
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4451
	startLine := 1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4452
	startCol := 1
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4453
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4454
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4455
    ^ startCol @ startLine
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4456
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4457
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4458
startPositionForSearchForward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4459
    ^ self startPositionForSearchForwardBasedOnSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4460
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4461
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4462
startPositionForSearchForwardBasedOnSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4463
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4464
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4465
    selectionStartLine notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4466
	startLine := selectionStartLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4467
	startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4468
    ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4469
	startLine := 1.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4470
	startCol := 1
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4471
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4472
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4473
    ^ startCol @ startLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4474
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4475
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4476
!TextView methodsFor:'selections'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4477
2604
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4478
changeTypeOfSelectionTo:newType
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4479
    "ignored here - but redefined in subclasses which
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4480
     differentiate between pasted- and user-selections"
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4481
!
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4482
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4483
expandSelectionDown
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4484
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4485
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4486
    selectionStartLine notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4487
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4488
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4489
	    selectionStartLine := selectionStartLine + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4490
	    (selectionStartLine > clickLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4491
	    or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4492
	    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4493
		t := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4494
		selectionStartLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4495
		selectionEndLine := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4496
		t := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4497
		selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4498
		selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4499
		expandingTop := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4500
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4501
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4502
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4503
	    selectionEndLine := selectionEndLine + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4504
	].
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4505
"/        self redrawLine:l.
2442
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4506
"/        self redrawLine:l+1.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4507
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4508
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4509
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4510
	self redrawFromLine:l to:l+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4511
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4512
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4513
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4514
    "Created: / 01-03-1996 / 23:35:08 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4515
    "Modified: / 18-03-1996 / 17:18:15 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4516
    "Modified: / 17-04-2012 / 21:01:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4517
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4518
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4519
expandSelectionLeft
502
6f3d0d7a782c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  4520
    |c l t c1 c2|
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4521
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4522
    selectionStartLine notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4523
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4524
	    selectionStartCol == 0 ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4525
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4526
	    selectionStartCol := (selectionStartCol - 1) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4527
	    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4528
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4529
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4530
	    selectionEndCol := (selectionEndCol - 1) max:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4531
	    c := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4532
	    selectionEndLine == selectionStartLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4533
		selectionEndCol <= selectionStartCol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4534
		    t := selectionStartCol. selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4535
		    selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4536
		    expandingTop := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4537
		    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4538
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4539
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4540
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4541
	c1 := c.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4542
	c2 := c1 + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4543
	c1 == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4544
	    c1 := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4545
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4546
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4547
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4548
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4549
	self redrawLine:l from:c1 to:c2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4550
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4551
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4552
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4553
    "Modified: / 18-03-1996 / 17:05:46 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4554
    "Modified: / 17-04-2012 / 21:01:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4555
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4556
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4557
expandSelectionRight
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4558
    |l c t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4559
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4560
    selectionStartLine notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4561
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4562
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4563
	    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4564
	    selectionStartCol := selectionStartCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4565
	    l == selectionEndLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4566
		c >= selectionEndCol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4567
		    expandingTop := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4568
		    t := selectionStartCol. selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4569
		    selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4570
		    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4571
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4572
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4573
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4574
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4575
	    c := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4576
	    selectionEndCol := selectionEndCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4577
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4578
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4579
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4580
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4581
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4582
	self redrawLine:l from:(c max:1) to:c+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4583
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4584
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4585
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4586
    "Created: / 01-03-1996 / 23:33:17 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4587
    "Modified: / 06-03-1996 / 13:54:10 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4588
    "Modified: / 17-04-2012 / 21:01:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4589
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4590
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4591
expandSelectionUp
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4592
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4593
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4594
    selectionStartLine notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4595
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4596
	    selectionStartLine := (selectionStartLine - 1) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4597
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4598
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4599
	    selectionEndLine := (selectionEndLine - 1) max:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4600
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4601
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4602
	    (selectionEndLine < clickLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4603
	    or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4604
	    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4605
		t := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4606
		selectionStartLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4607
		selectionEndLine := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4608
		t := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4609
		selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4610
		selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4611
		l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4612
		expandingTop := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4613
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4614
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4615
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4616
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4617
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4618
	"/ self redrawLine:l.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4619
	"/ self redrawLine:l+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4620
	self redrawFromLine:l to:l+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4621
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4622
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4623
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4624
    "Modified: / 06-03-1996 / 14:12:06 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4625
    "Modified: / 17-04-2012 / 21:01:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4626
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4627
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4628
hasSelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4629
    "return true, if there is a selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4630
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4631
    ^ selectionStartLine notNil
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4632
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4633
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4634
hasSelectionForCopy
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4635
    "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
  4636
     (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
  4637
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4638
    ^ self hasSelection
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4639
!
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4640
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4641
hasSelectionWithinSingleLine
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4642
    "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
  4643
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4644
    ^ selectionStartLine notNil
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4645
      and:[ selectionStartLine == selectionEndLine ]
3315
1b42d2f8dcbc CRLF management
fm
parents: 3308
diff changeset
  4646
1b42d2f8dcbc CRLF management
fm
parents: 3308
diff changeset
  4647
    "Modified: / 04-07-2006 / 18:42:59 / fm"
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4648
!
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4649
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4650
hasSingleFullLineSelected
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4651
    ^ (selectionStartLine notNil
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4652
      and:[selectionEndLine notNil
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4653
      and:[selectionEndLine == (selectionStartLine+1)
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4654
      and:[selectionStartCol == 1
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4655
      and:[selectionEndCol == 0
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4656
    ]]]])
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4657
!
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4658
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4659
isInSelection:line col:aColNr
96256221e3af support drag
ca
parents: 2581
diff changeset
  4660
    "returns true, if the line, and column is in the selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  4661
    "
3438
d83030fd5005 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3426
diff changeset
  4662
    selectionStartLine isNil ifTrue:[^ false].
d83030fd5005 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3426
diff changeset
  4663
    selectionEndLine   isNil ifTrue:[^ false].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4664
96256221e3af support drag
ca
parents: 2581
diff changeset
  4665
    (line between:selectionStartLine and:selectionEndLine) ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4666
	^ false
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4667
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  4668
96256221e3af support drag
ca
parents: 2581
diff changeset
  4669
    line == selectionStartLine ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4670
	aColNr < selectionStartCol ifTrue:[^ false]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4671
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  4672
96256221e3af support drag
ca
parents: 2581
diff changeset
  4673
    line == selectionEndLine ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4674
	(selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4675
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  4676
    ^ true
96256221e3af support drag
ca
parents: 2581
diff changeset
  4677
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  4678
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4679
makeSelectionVisible
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4680
    "scroll to make the selection visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4681
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4682
    |line col|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4683
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4684
    selectionStartLine notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4685
	expandingTop == true ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4686
	    line := selectionStartLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4687
	    col := selectionStartCol.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4688
	] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4689
	    line := selectionEndLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4690
	    col := selectionEndCol.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4691
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4692
	self makeLineVisible:line.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4693
	self makeColVisible:col inLine:line.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4694
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4695
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4696
    "Modified: 6.3.1996 / 13:53:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4697
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4698
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4699
selectAll
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4700
    "select the whole text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4701
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4702
    self selectFromLine:1 col:1 toLine:(list size + 1) col:0
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4703
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4704
4140
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4705
selectFromCharacterPosition:pos1
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4706
    "compute line/col from the character position and select the text up to the end"
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4707
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4708
    |line1 col1 line2 col2|
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4709
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4710
    line1 := self lineOfCharacterPosition:pos1.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4711
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4712
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4713
    line2 := (list size + 1).
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4714
    col2 := 0.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4715
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4716
!
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4717
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4718
selectFromCharacterPosition:pos1 to:pos2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4719
    "compute line/col from character positions and select the text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4720
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4721
    |line1 col1 line2 col2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4722
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4723
    pos1 > pos2 ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4724
	^ self unselect
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4725
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4726
    line1 := self lineOfCharacterPosition:pos1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4727
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4728
    col1 < 1 ifTrue:[ col1 := 1 ].
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4729
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4730
    line2 := self lineOfCharacterPosition:pos2.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4731
    col2 := pos2 - (self characterPositionOfLine:line2 col:1) + 1.
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4732
    col2 < 1 ifTrue:[ col2 := 1 ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4733
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4734
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4735
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4736
selectFromLine:startLine col:startCol toLine:endLine col:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4737
    "select a piece of text and redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4738
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4739
    | oldStartCol oldEndCol oldStartLine oldEndLine |
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4740
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4741
    oldStartCol := selectionStartCol ? startCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4742
    oldStartLine := selectionStartLine ? startLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4743
    oldEndCol := selectionEndCol ? endCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4744
    oldEndLine := selectionEndLine ? endLine.  
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4745
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4746
    self unselectWithoutRedraw.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4747
    startLine notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4748
	"new:"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4749
	endLine < startLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4750
	    ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4751
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4752
	(endLine == startLine and:[endCol < startCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4753
	    endCol ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4754
		self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4755
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4756
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4757
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4758
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4759
        " old:
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4760
	endLine < startLine ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4761
	(startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4762
        "
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4763
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4764
	selectionStartLine := startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4765
	selectionStartCol := startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4766
	selectionEndLine := endLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4767
	selectionEndCol := endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4768
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4769
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4770
	self selectionChanged.
4787
cc11ec8d6855 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4785
diff changeset
  4771
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4772
        (selectionStartLine == selectionEndLine 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4773
            and:[oldStartLine == selectionStartLine 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4774
                and:[oldEndLine == selectionEndLine]]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4775
                    self redrawLine:selectionStartLine 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4776
                               from:(selectionStartCol min: oldStartCol) 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4777
                                 to:(selectionEndCol max: oldEndCol)
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4778
                ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4779
                    (selectionStartLine min: oldStartLine) to: (selectionEndLine max: oldEndLine) do:[:lineNr |
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4780
                        self redrawLine:lineNr
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4781
                    ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4782
                ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4783
	selectStyle := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4784
    ]
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4785
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4786
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4787
     |v|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4788
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4789
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4790
     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
  4791
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4792
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4793
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4794
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4795
     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
  4796
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4797
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4798
    "Modified: / 02-01-1997 / 13:32:25 / cg"
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4799
    "Modified: / 28-08-2013 / 01:16:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4800
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4801
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4802
selectFromLine:startLine toLine:endLine
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4803
    "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
  4804
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4805
    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
  4806
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4807
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4808
     |v|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4809
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4810
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4811
     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
  4812
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4813
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4814
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4815
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4816
     v selectFromLine:2 toLine:10
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4817
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4818
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4819
    "Modified: 29.4.1996 / 12:23:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4820
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4821
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4822
selectLine:selectLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4823
    "select one line and redraw it"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4824
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4825
    self selectFromLine:selectLine col:1 toLine:(selectLine + 1) col:0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4826
    wordStartCol := selectionStartCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4827
    wordEndCol := selectionEndCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4828
    wordStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4829
    wordEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4830
    selectStyle := #line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4831
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4832
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4833
selectLineAtY:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4834
    "select the line at given y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4835
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  4836
    |selectLine|
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  4837
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  4838
    selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4839
    selectLine notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4840
	self selectLine:selectLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4841
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4842
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4843
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4844
selectLineWhereCharacterPosition:pos
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4845
    "select the line, where characterPosition pos is living.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4846
     The argument pos starts at 1 from the start of the text
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4847
     and counts characters (i.e. can be used to convert from
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4848
     character position within a string to line-position in view)."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4849
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4850
    self selectLine:(self lineOfCharacterPosition:pos)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4851
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4852
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4853
selectWordAtLine:line col:col
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4854
    "select the word at given line/col"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4855
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4856
    self
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4857
	wordAtLine:line col:col do:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4858
	    :beginLine :beginCol :endLine :endCol :style |
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4859
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4860
	    self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4861
	    selectStyle := style
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4862
	]
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  4863
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  4864
    "Modified: 18.3.1996 / 17:30:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4865
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4866
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4867
selectWordAtX:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4868
    "select the word at given x/y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4869
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4870
    |selectVisibleLine selectLine selectCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4871
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4872
    selectStyle := nil.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4873
    selectVisibleLine := self visibleLineOfY:y.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4874
    selectLine := self visibleLineToListLine:selectVisibleLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4875
    selectLine notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4876
	selectCol := self colOfX:x inVisibleLine:selectVisibleLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4877
	self selectWordAtLine:selectLine col:selectCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4878
    ]
1661
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  4879
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  4880
    "Modified: / 8.9.1998 / 21:22:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4881
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4882
3528
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  4883
selectedInterval
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  4884
    "return the selection-boundaries as interval"
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  4885
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  4886
    ^ self selectionStartIndex to:(self selectionStopIndex - 1)
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  4887
!
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  4888
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4889
selection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4890
    "return the selection as a collection of (line-)strings.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4891
     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
  4892
     collection will be an empty string."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4893
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  4894
    |sel|
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  4895
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4896
    selectionStartLine isNil ifTrue:[^ nil].
4466
5c7a01426564 changed: #selection
Claus Gittinger <cg@exept.de>
parents: 4462
diff changeset
  4897
    sel := self textFromLine:selectionStartLine col:(selectionStartCol max:1) toLine:selectionEndLine col:selectionEndCol.
5391
98080a3105ae class: TextView
Claus Gittinger <cg@exept.de>
parents: 5378
diff changeset
  4898
    sel notEmptyOrNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4899
	(gc characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4900
	    sel := sel encodeFrom:gc characterEncoding into:#'iso10646-1'
5391
98080a3105ae class: TextView
Claus Gittinger <cg@exept.de>
parents: 5378
diff changeset
  4901
        ].
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  4902
    ].
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  4903
    ^ sel
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
  4904
4361
646cd7c5513e comment/format in: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents: 4321
diff changeset
  4905
    "Modified (comment): / 25-01-2012 / 00:29:09 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4906
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4907
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  4908
selectionAsString
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  4909
    "return the selection as a String (i.e. without emphasis)"
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  4910
2693
9e7da8ff444d unused methodLocals removed
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
  4911
    |sel|
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  4912
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  4913
    (sel := self selection) isNil ifTrue:[^ nil].
2419
2ae3350454bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  4914
    sel := sel collect:[:each| each isNil ifTrue:[nil] ifFalse:[each string]].
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  4915
    ^ (sel asStringWithCRsFrom:1 to:(sel size) compressTabs:false withCR:false) string
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  4916
!
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  4917
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  4918
selectionChanged
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  4919
    "can be redefined for notification or special actions"
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4920
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4921
    "Modified: / 17-04-2012 / 20:59:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  4922
!
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  4923
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4924
selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4925
    ^ selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4926
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4927
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4928
selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4929
    ^ selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4930
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4931
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4932
selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4933
    ^ selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4934
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4935
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4936
selectionStartLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4937
    ^ selectionStartLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4938
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4939
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4940
setPrimarySelection
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4941
    "can be redefined for notification or special actions"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4942
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4943
    self graphicsDevice notNil ifTrue:[
5087
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
  4944
        "On X11, be nice and set the PRIMARY selection.
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
  4945
         (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4946
	self graphicsDevice setPrimaryText: self selectionAsString ownerView: self.
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4947
    ].
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4948
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4949
    "Created: / 17-04-2012 / 20:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4950
!
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4951
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  4952
st80SelectMode
3459
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  4953
    st80SelectMode notNil ifTrue:[^ st80SelectMode].
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  4954
    ^ self class st80SelectMode
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  4955
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  4956
    "Created: / 03-07-2006 / 16:30:59 / cg"
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  4957
!
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  4958
3459
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  4959
st80SelectMode:aBoolean
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  4960
    st80SelectMode := aBoolean
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  4961
!
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  4962
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4963
unselect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4964
    "unselect - if there was a selection redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4965
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4966
    |startLine endLine startVisLine endVisLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4967
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4968
    selectionStartLine notNil ifTrue:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4969
	startLine := selectionStartLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4970
	endLine := selectionEndLine.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4971
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4972
	self unselectWithoutRedraw.
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4973
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4974
	"/ if the selection is not visible, we are done
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4975
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4976
	startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4977
	endLine < firstLineShown ifTrue:[^ self].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4978
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4979
	startLine < firstLineShown ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4980
	    startVisLine := 1
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4981
	] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4982
	    startVisLine := self listLineToVisibleLine:startLine
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4983
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4984
	endLine >= (firstLineShown + nLinesShown) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4985
	    endVisLine := nLinesShown
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4986
	] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4987
	    endVisLine := self listLineToVisibleLine:endLine
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4988
	].
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4989
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4990
	"/ if its only part of a line, just redraw what has to be
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4991
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4992
	(startLine == endLine) ifTrue:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4993
	    super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4994
	] ifFalse:[
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4995
	    self redrawFromVisibleLine:startVisLine to:endVisLine
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4996
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4997
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4998
    selectStyle := nil
503
468d4a36ed67 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
  4999
715
a5856fcdbf0f fixed unselect-redraw
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  5000
    "Modified: 29.5.1996 / 14:54:11 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5001
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5002
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5003
unselectWithoutRedraw
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5004
    "forget selection but do not redraw the selection area
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5005
     - 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
  5006
     known to be invisible (however, redraw knows about that anyway)."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5007
2735
5ba2010aefa4 *** empty log message ***
penk
parents: 2730
diff changeset
  5008
    selectionStartLine := selectionEndLine := nil.
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5009
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5010
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5011
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5012
validateNewSelection
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5013
     "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
  5014
      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
  5015
      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
  5016
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5017
    ^ self
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5018
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5019
    "Modified: 29.4.1996 / 12:32:08 / cg"
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5020
!
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5021
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5022
withSelectionForeground:hilightFg background:hilightBg do:aBlock
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5023
    "evaluate aBlock while the selection is shown highlighted with colors passed as args."
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5024
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5025
    |oldFg oldBg|
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5026
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5027
    "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5028
     change color of selection & hide cursor
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5029
    "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5030
    oldFg := selectionFgColor.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5031
    oldBg := selectionBgColor.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5032
    selectionBgColor := hilightBg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5033
    selectionFgColor := hilightFg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5034
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5035
    expandingTop := true.       "/ hack to make the top of the selection visible
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5036
    self makeSelectionVisible.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5037
    selectionStartLine notNil ifTrue:[
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5038
        selectionEndLine notNil ifTrue:[
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5039
            self redrawFromLine:selectionStartLine to:selectionEndLine.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5040
        ].
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5041
    ].
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5042
    self flush.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5043
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5044
    aBlock ensure:[
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5045
        "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5046
         undo selection color change and show cursor again
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5047
        "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5048
        selectionFgColor := oldFg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5049
        selectionBgColor := oldBg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5050
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5051
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5052
4310
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5053
!TextView methodsFor:'testing'!
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5054
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5055
isTextView
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5056
    "I am showing text"
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5057
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5058
    ^ true
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5059
! !
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5060
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  5061
!TextView class methodsFor:'documentation'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5062
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5063
version
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  5064
    ^ '$Header$'
3964
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5065
!
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5066
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5067
version_CVS
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  5068
    ^ '$Header$'
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  5069
!
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  5070
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  5071
version_HG
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  5072
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  5073
    ^ '$Changeset: <not expanded> $'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5074
! !
2630
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
  5075
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  5076
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  5077
TextView initialize!