TextView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 14 Jun 2016 08:56:15 +0100
branchjv
changeset 5771 9ee6810e35da
parent 5767 3f4eb92d9db1
parent 5768 b1b202871d42
child 5809 a5cecde02b21
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
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
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
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    17
	instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    18
		selectionEndCol clickPos clickStartLine clickStartCol clickLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    19
		clickCol clickCount expandingTop wordStartCol wordStartLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    20
		wordEndCol wordEndLine selectionFgColor selectionBgColor
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    21
		selectStyle directoryForFileDialog defaultFileNameForFileDialog
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    22
		externalEncoding contentsWasSaved searchAction lastSearchPattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    23
		lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    24
		lastSearchWasVariableSearch parenthesisSpecification dropSource
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    25
		dragIsActive saveAction st80SelectMode searchBarActionBlock'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    26
	classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    27
		DefaultSelectionBackgroundColor
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    28
		DefaultAlternativeSelectionForegroundColor
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    29
		DefaultAlternativeSelectionBackgroundColor MatchDelayTime
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    30
		WordSelectCatchesBlanks LastSearchPatterns
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    31
		NumRememberedSearchPatterns LastSearchIgnoredCase
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    32
		LastSearchWasMatch DefaultParenthesisSpecification
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    33
		LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    34
		LastSearchWasReplace LastSearchReplacedString'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    35
	poolDictionaries:''
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    36
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    37
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    38
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
    39
!TextView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    40
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    41
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    42
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    43
 COPYRIGHT (c) 1989 by Claus Gittinger
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    44
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    45
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    46
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    47
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    48
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    49
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    50
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    51
 hereby transferred.
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
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    54
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
    55
documentation
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    56
"
120
claus
parents: 119
diff changeset
    57
    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
    58
    The text is not editable and there is no cursor.
120
claus
parents: 119
diff changeset
    59
    Use TextViews for readonly text, EditTextView for editable text.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    60
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
    61
    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
    62
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
    63
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    64
120
claus
parents: 119
diff changeset
    65
      selectionStartLine      <Number>                the line of the selection start (or nil)
claus
parents: 119
diff changeset
    66
      selectionStartCol       <Number>                the col of the selection start
claus
parents: 119
diff changeset
    67
      selectionEndLine        <Number>                the line of the selection end
claus
parents: 119
diff changeset
    68
      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
    69
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    70
      clickStartLine          <Number>                temporary - remember where select operation started
120
claus
parents: 119
diff changeset
    71
      clickStartCol           <Number>                temporary
claus
parents: 119
diff changeset
    72
      clickLine               <Number>                temporary
claus
parents: 119
diff changeset
    73
      clickCol                <Number>                temporary
claus
parents: 119
diff changeset
    74
      clickCount              <Number>                temporary
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    75
      expandingTop            <Boolean>               temporary - for expandSelection
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    76
120
claus
parents: 119
diff changeset
    77
      selectionFgColor        <Color>                 color used to draw selections
claus
parents: 119
diff changeset
    78
      selectionBgColor        <Color>                 color used to draw selections
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    79
120
claus
parents: 119
diff changeset
    80
      selectStyle             <Symbol>                how words are selected
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    81
120
claus
parents: 119
diff changeset
    82
      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
    83
120
claus
parents: 119
diff changeset
    84
      contentsWasSaved        <Boolean>               set to true, whenever saved in a file
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
    85
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
    86
      externalEncoding        <Symbol|nil>            external encoding, used when text is saved to
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    87
						      a file. Usually something like
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    88
						      #jis7, #euc, #sjis etc.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    89
						      (currently only passed down from the
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    90
						       fileBrowser)
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
    91
96256221e3af support drag
ca
parents: 2581
diff changeset
    92
      dropSource              <DropSource>            drag operation descriptor or nil (dragging disabled)
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    93
      dragIsActive            <Boolean>               true, drag operation is activated
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    94
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    95
      searchAction            <Block>                 an autosearch action; typically set by the browser.
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    96
						      Will be used as default when searchFwd/searchBwd is
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    97
						      pressed. If the searchPattern is changed, no autosearch
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    98
						      action will be executed.
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
    99
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   100
      searchBarActionBlock    <Block>                 search action block for embedded search
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   101
						      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
   102
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   103
    [class variables:]
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   104
	ST80Selections        <Boolean>               enables ST80 style doubleclick behavior
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   105
						      (right after opening parenthesis, right before
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   106
						       closing parenthesis, at begin of a line
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   107
						       at begin of text)
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   108
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   109
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   110
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   111
      textView.background                       defaults to viewBackground
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   112
      textView.ViewFont                         defaults to textFont
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   113
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   114
      text.st80Selections                       st80 behavior (click on char after parent or quote)
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   115
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   116
      text.selectionForegroundColor             defaults to textBackgroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   117
      text.selectionBackgroundColor             defaults to textForegroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   118
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   119
      text.alternativeSelectionForegroundColor  pasted text (i.e. paste will not replace)
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   120
						defaults to selectionForegroundColor
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   121
      text.alternativeSelectionBackgroundColor  pasted text (i.e. paste will not replace)
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   122
						defaults to selectionBackgroundColor
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   123
    [author:]
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   124
	Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   125
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   126
    [see also:]
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   127
	EditTextView CodeView Workspace
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   128
"
1014
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
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   131
examples
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   132
"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   133
    although textViews (and instances of subclasses) are mostly used
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   134
    as components (in the fileBrowser, the browser, the launcher etc.),
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   135
    they may also be opened as a textEditor;
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   136
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   137
    open a (readonly) textView on some information text:
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   138
							[exBegin]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   139
	TextView
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   140
	    openWith:'read this'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   141
	    title:'demonstration'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   142
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   143
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   144
    the same, but open it modal:
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   145
							[exBegin]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   146
	TextView
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   147
	    openModalWith:'read this first'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   148
	    title:'demonstration'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   149
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   150
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   151
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   152
    open it modal (but editable) on some text:
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   153
    (must accept before closing)
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   154
    This is somewhat kludgy - when closed, the view has already
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   155
    nilled its link to the model. Therefore, the accept must be
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   156
    done 'manually' below.
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   157
    However, usually an applicationModel is installed as the
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   158
    editor-topViews application. This would get a closeRequest,
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   159
    where it could handle things.
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   160
							[exBegin]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   161
	|m textView|
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   162
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   163
	m := 'read this first' asValue.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   164
	textView := EditTextView openModalOnModel:m.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   165
	textView modified ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   166
	    (self confirm:'text was not accepted - do it now ?')
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   167
	    ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   168
		m value:textView contents
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   169
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   170
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   171
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   172
	Transcript showCR:m value.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   173
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   174
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   175
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   176
    open a textEditor on some file:
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   177
							[exBegin]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   178
	EditTextView openOn:'Makefile'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   179
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   180
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   181
"
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   182
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   183
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   184
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   185
!TextView class methodsFor:'instance creation'!
119
claus
parents: 97
diff changeset
   186
claus
parents: 97
diff changeset
   187
on:aModel aspect:aspect change:change menu:menu initialSelection:initial
claus
parents: 97
diff changeset
   188
    "for ST-80 compatibility"
claus
parents: 97
diff changeset
   189
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   190
    ^ (self new)
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   191
	on:aModel
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   192
	aspect:aspect
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   193
	list:aspect
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   194
	change:change
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   195
	menu:menu
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   196
	initialSelection:initial
3280
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
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   199
with:someText
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   200
    ^ (self new)
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   201
	contents:someText
119
claus
parents: 97
diff changeset
   202
! !
claus
parents: 97
diff changeset
   203
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   204
!TextView class methodsFor:'class initialization'!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   205
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   206
initialize
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   207
    DefaultParenthesisSpecification isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   208
	DefaultParenthesisSpecification := IdentityDictionary new.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   209
	DefaultParenthesisSpecification at:#open        put:#( $( $[ ${ "$> $<") .
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   210
	DefaultParenthesisSpecification at:#close       put:#( $) $] $} "$> $<").
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   211
	DefaultParenthesisSpecification at:#ignore      put:#( $' $" '$[' '$]' '${' '$)' ).
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   212
	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
   213
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   214
! !
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   215
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   216
!TextView class methodsFor:'defaults'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
   217
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   218
defaultIcon
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   219
    "return the default icon if started as a topView"
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   220
3496
8c92a96c4e27 icon resource
Claus Gittinger <cg@exept.de>
parents: 3491
diff changeset
   221
    <resource: #programImage>
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   222
    <resource: #style (#ICON #ICON_FILE)>
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   223
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   224
    |nm i|
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   225
1146
027884518745 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   226
    i := self classResources at:'ICON' default:nil.
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   227
    i isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   228
	nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   229
	i := Smalltalk imageFromFileNamed:nm forClass:self.
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   230
    ].
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   231
    i notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   232
	i := i onDevice:Display
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   233
    ].
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   234
    ^ i
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   235
3496
8c92a96c4e27 icon resource
Claus Gittinger <cg@exept.de>
parents: 3491
diff changeset
   236
    "Modified: / 17-09-2007 / 11:36:29 / cg"
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   237
!
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   238
910
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   239
defaultMenuMessage
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   240
    "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
   241
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   242
    ^ #editMenu
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   243
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   244
    "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
   245
!
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   246
4254
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
    ^ DefaultParenthesisSpecification
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   249
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   250
    "Created: / 14-06-2011 / 14:00:59 / cg"
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   251
!
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   252
2306
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   253
defaultSelectionBackgroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   254
    "return the default selection background color"
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   255
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   256
    ^DefaultSelectionBackgroundColor
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
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   259
defaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   260
    "return the default selection foreground color"
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   261
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   262
    ^DefaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   263
!
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   264
1477
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   265
defaultViewBackgroundColor
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   266
    "return the default view background"
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   267
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   268
    ^DefaultViewBackground
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   269
!
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   270
3226
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
    ^ LastSearchIgnoredCase
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   273
!
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   274
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   275
lastSearchWasMatch
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   276
    ^ LastSearchWasMatch
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   277
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   278
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   279
st80SelectMode
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   280
    ^ UserPreferences current st80SelectMode
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   281
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   282
    "Modified: / 03-07-2006 / 16:26:44 / cg"
1729
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
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   285
st80SelectMode:aBoolean
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   286
    UserPreferences current st80SelectMode:aBoolean
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   287
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   288
    "Created: / 07-01-1999 / 13:35:24 / cg"
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   289
    "Modified: / 03-07-2006 / 16:27:01 / cg"
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   290
!
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   291
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
   292
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   293
    "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
   294
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   295
    <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
   296
                       #'text.selectionForegroundColor'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   297
                       #'text.selectionBackgroundColor'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   298
                       #'text.alternativeSelectionForegroundColor'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   299
                       #'text.alternativeSelectionBackgroundColor'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   300
                       #'textView.font'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   301
                       #'text.wordSelectCatchesBlanks'
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   302
                       #'text.st80Selections')>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   303
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   304
    DefaultViewBackground := StyleSheet colorAt:'textView.background' default:Color white.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   305
    DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   306
    DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'.
2630
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   307
"/    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
   308
"/    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
   309
    DefaultAlternativeSelectionForegroundColor := DefaultSelectionForegroundColor.
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   310
    DefaultAlternativeSelectionBackgroundColor := DefaultSelectionBackgroundColor.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   311
    DefaultFont := StyleSheet fontAt:'textView.font'.
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
   312
    MatchDelayTime := 0.6.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   313
    WordSelectCatchesBlanks := StyleSheet at:'text.wordSelectCatchesBlanks' default:false.
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   314
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   315
    "Modified: / 03-07-2006 / 16:29:42 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   316
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   317
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   318
!TextView class methodsFor:'help specs'!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   319
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   320
flyByHelpSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   321
    "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
   322
     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
   323
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   324
    "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
   325
     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
   326
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   327
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   328
     UIHelpTool openOnClass:TextView
4462
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
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   331
    <resource: #help>
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   332
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   333
    ^ Dictionary new addPairsFrom:#(
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   334
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   335
#matchSearch
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   336
'Search for a pattern (GLOB) as opposed to a direct string search'
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   337
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   338
#searchCaseSensitive
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   339
'Care for case differences'
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   340
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   341
#searchFullWord
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   342
'Search only for full words (ignore occurrences in substring)'
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   343
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   344
#searchAtBeginOfLineOnly
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   345
'Search only for the string at the beginning of a line'
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   346
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   347
#searchPattern
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   348
'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
   349
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   350
#searchVariable
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   351
'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
   352
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   353
#replaceText
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   354
'If checked, matching text is replaced by this'
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   355
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   356
#selectLines
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   357
'If checked, lines containing the matched string are selected.'
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   358
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   359
#replacePreserveCase
5727
59553507b326 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5726
diff changeset
   360
'Preserve the title case of replaced text'
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   361
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   362
#replaceAll
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   363
'Search and replace all occurrences of the searched string'
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   364
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   365
#searchWithWrap
5726
04a5c547c98f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5716
diff changeset
   366
'Wrap around at the end of the text, and continue the search from the top'
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   367
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   368
#matchWithRegex
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   369
'Use regex pattern for search (as opposed to GLOB pattern)'
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   370
)
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   371
! !
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   372
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   373
!TextView class methodsFor:'interface specs'!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   374
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   375
searchDialogSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   376
    "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
   377
     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
   378
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   379
    "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
   380
     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
   381
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   382
    "
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   383
     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
   384
    "
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   385
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   386
    <resource: #canvas>
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   387
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   388
    ^
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   389
    #(FullSpec
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   390
       name: searchDialogSpec
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   391
       window:
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   392
      (WindowSpec
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   393
	 label: 'String search'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   394
	 name: 'String search'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   395
	 min: (Point 10 10)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   396
	 max: (Point 1280 1024)
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   397
         bounds: (Rectangle 0 0 475 376)
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   398
       )
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   399
       component:
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   400
      (SpecCollection
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   401
	 collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   402
	  (LabelSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   403
	     label: 'SearchPattern:'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   404
	     name: 'label'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   405
	     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
   406
	     level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   407
	     translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   408
	     adjust: left
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   409
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   410
	  (ComboBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   411
	     name: 'patternComboBox'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   412
	     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
   413
	     activeHelpKey: searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   414
	     tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   415
	     model: searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   416
	     immediateAccept: false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   417
	     acceptOnLeave: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   418
	     acceptOnReturn: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   419
	     acceptOnTab: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   420
	     acceptOnLostFocus: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   421
	     acceptOnPointerLeave: false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   422
	     autoSelectInitialText: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   423
	     comboList: patternList
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   424
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   425
	  (VerticalPanelViewSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   426
	     name: 'VerticalPanel1'
5460
c353fd71390d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5443
diff changeset
   427
             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
   428
	     horizontalLayout: fit
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   429
	     verticalLayout: top
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   430
	     component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   431
	    (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   432
	       collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   433
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   434
		   label: 'Case Sensitive'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   435
		   name: 'ignoreCaseCheckBox'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   436
		   activeHelpKey: searchCaseSensitive
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   437
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   438
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   439
		   model: caseSensitive
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   440
		   translateLabel: true
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   441
                   extent: (Point 475 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   442
		 )
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   443
                (ViewSpec
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   444
                   name: 'MatchBox'
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   445
                   component: 
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   446
                  (SpecCollection
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   447
                     collection: (
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   448
                      (CheckBoxSpec
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   449
                         label: 'Match (forward only)'
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   450
                         name: 'matchCheckBox'
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   451
                         layout: (LayoutFrame 0 0 0 0 260 0 0 1)
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   452
                         activeHelpKey: matchSearch
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   453
                         level: 0
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   454
                         tabable: true
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   455
                         model: match
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   456
                         translateLabel: true
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   457
                       )
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   458
                      (CheckBoxSpec
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   459
                         label: 'Regex Match'
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   460
                         name: 'CheckBox6'
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   461
                         layout: (LayoutFrame -170 1 0 0 0 1 22 0)
5557
6578803bd491 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5556
diff changeset
   462
                         activeHelpKey: matchWithRegex
5559
f093f20bf2e7 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5557
diff changeset
   463
                         enableChannel: matchWithRegexVisible
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   464
                         model: matchWithRegex
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   465
                         translateLabel: true
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   466
                       )
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   467
                      )
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   468
                    
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
   469
                   )
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   470
                   extent: (Point 475 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   471
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   472
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   473
		   label: 'Search Full Words'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   474
		   name: 'CheckBox2'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   475
		   activeHelpKey: searchFullWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   476
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   477
		   enableChannel: searchFullWordEnabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   478
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   479
		   model: searchFullWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   480
		   translateLabel: true
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   481
                   extent: (Point 475 24)
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   482
                 )
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   483
                (CheckBoxSpec
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   484
                   label: 'At Begin of Line Only'
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   485
                   name: 'CheckBox5'
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   486
                   activeHelpKey: searchAtBeginOfLineOnly
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   487
                   level: 0
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   488
                   tabable: true
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   489
                   model: searchAtBeginOfLineOnly
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   490
                   translateLabel: true
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   491
                   extent: (Point 475 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   492
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   493
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   494
		   label: 'Variable Only'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   495
		   name: 'CheckBox1'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   496
		   activeHelpKey: searchVariable
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   497
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   498
		   visibilityChannel: searchVariableVisible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   499
		   enableChannel: searchVariableEnabled
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: searchVariable
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
		   labelChannel: stringWithVariableUnderCursorHolder
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   504
                   extent: (Point 475 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   505
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   506
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   507
		   label: 'Select Lines'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   508
		   name: 'CheckBox3'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   509
		   activeHelpKey: selectLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   510
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   511
		   initiallyInvisible: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   512
		   tabable: true
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
   513
                   model: selectLinesHolder
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   514
		   translateLabel: true
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   515
                   extent: (Point 429 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   516
		 )
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   517
                (CheckBoxSpec
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   518
                   label: 'Wrap at End of Text (forward only)'
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   519
                   name: 'CheckBox7'
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   520
                   activeHelpKey: searchWithWrap
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   521
                   level: 0
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   522
                   tabable: true
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   523
                   model: wrapAtEndOfTextHolder
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   524
                   translateLabel: true
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   525
                   extent: (Point 475 24)
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   526
                 )
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   527
                (ViewSpec
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   528
                   name: 'Box1'
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   529
                   extent: (Point 475 10)
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
   530
                 )
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   531
                (HorizontalPanelViewSpec
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   532
                   name: 'HorizontalPanel1'
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   533
                   horizontalLayout: leftFit
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   534
                   verticalLayout: fit
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   535
                   ignoreInvisibleComponents: false
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   536
                   elementsChangeSize: true
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   537
		   component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   538
		  (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   539
		     collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   540
		      (CheckBoxSpec
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   541
                         label: 'Replace By:'
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   542
			 name: 'CheckBox4'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   543
			 activeHelpKey: replaceText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   544
			 level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   545
			 enableChannel: replaceEnabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   546
			 tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   547
			 model: replaceBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   548
			 translateLabel: true
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   549
                         resizeForLabel: true
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   550
                         useDefaultExtent: true
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   551
		       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   552
		      (InputFieldSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   553
			 name: 'ReplaceEntryField'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   554
			 activeHelpKey: replaceText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   555
			 visibilityChannel: replaceBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   556
			 enableChannel: replaceBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   557
			 model: replaceTextHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   558
			 acceptOnReturn: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   559
			 acceptOnTab: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   560
			 acceptOnPointerLeave: true
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   561
                         extent: (Point 297 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   562
		       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   563
		      )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   564
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   565
		   )
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   566
                   extent: (Point 475 24)
4605
ea4d356f3f96 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4602
diff changeset
   567
                 )
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   568
                (CheckBoxSpec
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   569
                   label: '  Replace All (to End of Text)'
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   570
                   name: 'CheckBox8'
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   571
                   activeHelpKey: replaceAll
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   572
                   level: 0
5559
f093f20bf2e7 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5557
diff changeset
   573
                   enableChannel: replaceBoolean
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   574
                   tabable: true
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   575
                   model: replaceAllBoolean
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   576
                   translateLabel: true
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   577
                   extent: (Point 475 24)
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
   578
                 )
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   579
                (CheckBoxSpec
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   580
                   label: '  Preserve Case'
5557
6578803bd491 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5556
diff changeset
   581
                   name: 'CheckBox9'
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   582
                   activeHelpKey: replacePreserveCase
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   583
                   level: 0
5559
f093f20bf2e7 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5557
diff changeset
   584
                   enableChannel: replaceBoolean
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   585
                   tabable: true
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   586
                   model: replacePreserveCaseBoolean
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   587
                   translateLabel: true
5768
b1b202871d42 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5765
diff changeset
   588
                   extent: (Point 475 24)
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   589
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   590
		)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   591
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
	  (HorizontalPanelViewSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   595
	     name: 'horizontalPanelView'
5460
c353fd71390d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5443
diff changeset
   596
             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
   597
	     level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   598
	     horizontalLayout: fitSpace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   599
	     verticalLayout: center
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   600
	     horizontalSpace: 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   601
	     verticalSpace: 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   602
	     ignoreInvisibleComponents: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   603
	     reverseOrderIfOKAtLeft: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   604
	     component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   605
	    (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   606
	       collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   607
		(ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   608
		   label: 'Cancel'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   609
		   name: 'cancelButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   610
		   level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   611
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   612
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   613
		   model: cancel
5460
c353fd71390d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5443
diff changeset
   614
                   useDefaultExtent: true
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   615
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   616
		(ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   617
		   label: 'Prev'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   618
		   name: 'prevButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   619
		   level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   620
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   621
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   622
		   model: prevAction
5460
c353fd71390d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5443
diff changeset
   623
                   useDefaultExtent: true
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   624
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   625
		(ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   626
		   label: 'Next'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   627
		   name: 'nextButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   628
		   level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   629
		   borderWidth: 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   630
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   631
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   632
		   model: nextAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   633
		   isDefault: true
5460
c353fd71390d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5443
diff changeset
   634
                   useDefaultExtent: true
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   635
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   636
		)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   637
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   638
	     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   639
	     keepSpaceForOSXResizeHandleH: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   640
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   641
	  )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   642
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   643
       )
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   644
     )
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   645
! !
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   646
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   647
!TextView class methodsFor:'startup'!
121
claus
parents: 120
diff changeset
   648
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   649
open
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   650
    "start an empty TextView"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   651
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   652
    ^ self openWith:nil
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   653
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   654
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   655
openModalOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   656
    "start a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   657
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   658
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   659
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   660
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   661
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   662
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   663
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   664
    "Created: 14.2.1997 / 15:24:12 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   665
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   666
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   667
openModalWith:aString
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   668
    "start a textView with aString as initial contents"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   669
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   670
    ^ self openModalWith:aString title:nil
1014
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
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   673
     TextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   674
     EditTextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   675
    "
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
    "Created: 14.2.1997 / 15:19:04 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   678
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   679
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   680
openModalWith:aString title:aTitle
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   681
    "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
   682
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   683
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   684
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   685
    textView := self setupWith:aString title:aTitle.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   686
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   687
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   688
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   689
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   690
     TextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   691
     EditTextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   692
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   693
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   694
    "Modified: 9.9.1996 / 19:32:29 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   695
    "Created: 14.2.1997 / 15:19:18 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   696
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   697
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   698
openOn:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   699
    "start a textView on a file; return the textView"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   700
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   701
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   702
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   703
    textView := self setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   704
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   705
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   706
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   707
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   708
     TextView openOn:'../../doc/overview.doc'
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   709
     EditTextView openOn:'../../doc/overview.doc'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   710
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   711
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   712
    "Modified: 14.2.1997 / 15:21:51 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   713
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   714
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   715
openOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   716
    "start a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   717
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   718
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   719
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   720
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   721
    textView topView open.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   722
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   723
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   724
    "Created: 14.2.1997 / 15:23:36 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   725
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   726
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   727
openWith:aStringOrStringCollection
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   728
    "start a textView with aStringOrStringCollection as initial contents"
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   729
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   730
    ^ self openWith:aStringOrStringCollection selected:false
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   731
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
     TextView openWith:'some text'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   734
     EditTextView openWith:'some text'
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
   735
     Workspace openWith:'some text'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   736
    "
119
claus
parents: 97
diff changeset
   737
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   738
    "Created: 10.12.1995 / 17:41:32 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   739
    "Modified: 5.3.1997 / 15:37:19 / cg"
126
claus
parents: 121
diff changeset
   740
!
claus
parents: 121
diff changeset
   741
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   742
openWith:aStringOrStringCollection selected:selectedBoolean
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   743
    "start a textView with aStringOrStringCollection as initial (optionally selected) contents.
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   744
     Return the textView."
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   745
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   746
    |textView|
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   747
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   748
    textView := self setupEmpty.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   749
    textView contents:aStringOrStringCollection selected:selectedBoolean.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   750
    textView topView open.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   751
    ^ textView
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   752
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   753
    "
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   754
     TextView openWith:'some text' selected:true
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   755
     EditTextView openWith:'some text' selected:false
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   756
    "
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   757
!
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   758
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   759
openWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   760
    "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
   761
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   762
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   763
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   764
    textView := self setupWith:aStringOrStringCollection title:aTitle.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   765
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   766
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   767
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   768
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   769
     TextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   770
     EditTextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   771
    "
126
claus
parents: 121
diff changeset
   772
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   773
    "Created: 10.12.1995 / 17:40:02 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   774
    "Modified: 5.3.1997 / 15:37:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   775
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   776
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   777
setupEmpty
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   778
    "create a textview in a topview, with horizontal and
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   779
     vertical scrollbars - a helper for #startWith: and #startOn:"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   780
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   781
    |top frame label|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   782
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   783
    label := 'unnamed'.
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   784
    top := StandardSystemView label:label icon:self defaultIcon.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   785
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   786
    frame := HVScrollableView
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   787
		for:self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   788
		miniScrollerH:true miniScrollerV:false
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   789
		in:top.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   790
    frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   791
    ^ frame scrolledView
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   792
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   793
    "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
   794
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   795
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   796
setupForFile:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   797
    "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
   798
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   799
    |textView|
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   800
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   801
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   802
    aFileName notNil ifTrue:[
5087
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
   803
        textView setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   804
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   805
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   806
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   807
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
   808
    "Created: / 14-02-1997 / 15:21:43 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
   809
    "Modified: / 25-10-2006 / 14:46:54 / cg"
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   810
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   811
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   812
setupForModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   813
    "setup a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   814
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   815
    |textView|
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   816
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   817
    textView := self setupEmpty.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   818
    textView model:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   819
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   820
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   821
    "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
   822
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   823
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   824
setupWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   825
    "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
   826
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   827
    |top textView|
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   828
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   829
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   830
    top := textView topView.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   831
    aTitle notNil ifTrue:[top label:aTitle].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   832
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   833
    aStringOrStringCollection notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   834
	textView contents:aStringOrStringCollection
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   835
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   836
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   837
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   838
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   839
    "Created: 9.9.1996 / 19:31:22 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   840
    "Modified: 5.3.1997 / 15:37:37 / cg"
119
claus
parents: 97
diff changeset
   841
! !
claus
parents: 97
diff changeset
   842
2744
cb920467a4b4 method category rename
Claus Gittinger <cg@exept.de>
parents: 2740
diff changeset
   843
!TextView methodsFor:'Compatibility-ST80'!
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   844
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   845
displaySelection:aBoolean
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   846
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   847
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   848
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   849
2118
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   850
editText:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   851
    "ST-80 compatibility: set the edited text."
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   852
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   853
    self contents:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   854
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   855
    "Created: / 5.2.2000 / 17:06:18 / cg"
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   856
!
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   857
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   858
selectAndScroll
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   859
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   860
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   861
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   862
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   863
selectFrom:startPos to:endPos
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   864
    "change the selection given two character positions."
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   865
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   866
    self selectFromCharacterPosition:startPos to:endPos
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   867
!
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   868
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   869
selectionStartIndex
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   870
    "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
   871
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   872
    ^ self characterPositionOfSelection
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   873
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   874
    "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
   875
!
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   876
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   877
selectionStopIndex
2052
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   878
    "ST-80 compatibility: return the character position of
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   879
     the character right after the selection."
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   880
2109
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   881
    |idx|
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   882
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   883
    idx := self characterPositionOfSelectionEnd.
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   884
    idx == 0 ifTrue:[^ 0].
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   885
    ^ idx + 1
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   886
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   887
    "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
   888
! !
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   889
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   890
!TextView methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   891
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   892
characterPositionOfSelection
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   893
    "return the character index of the first character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   894
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   895
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   896
    selectionStartLine isNil ifTrue:[^ 0].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   897
    ^ self characterPositionOfLine:selectionStartLine
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   898
			       col:selectionStartCol
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   899
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   900
    "Modified: 14.8.1997 / 16:35:37 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   901
!
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   902
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   903
characterPositionOfSelectionEnd
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   904
    "return the character index of the last character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   905
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   906
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   907
    selectionStartLine isNil ifTrue:[^ 0].
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   908
    ^ self characterPositionOfLine:selectionEndLine
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   909
			       col:selectionEndCol
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   910
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   911
    "Created: 14.8.1997 / 16:35:24 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   912
    "Modified: 14.8.1997 / 16:35:45 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   913
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   914
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   915
contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   916
    "return true, if the contents was saved (by a save action),
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   917
     false if not (or was modified again after the last save)."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   918
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   919
    ^ contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   920
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   921
3214
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   922
contentsWasSaved:aBoolean
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   923
    contentsWasSaved := aBoolean
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   924
!
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   925
3212
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   926
defaultFileNameForFileDialog
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   927
    "return the default fileName to use for the save-box"
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   928
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   929
    ^ defaultFileNameForFileDialog
3212
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   930
!
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   931
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   932
defaultFileNameForFileDialog:aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   933
    "define the default fileName to use for the save-box"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   934
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   935
    defaultFileNameForFileDialog := aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   936
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   937
    "Created: 13.2.1997 / 18:29:53 / cg"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   938
!
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   939
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   940
directoryForFileDialog:aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   941
    "define the default directory to use for save-box"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   942
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   943
    directoryForFileDialog := aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   944
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   945
    "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
   946
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   947
2941
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   948
externalEncoding
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   949
    "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
   950
     This is (currently only) passed down from the fileBrowser,
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   951
     and required when  utf8/japanese/chinese/korean text is edited.
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   952
     (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
   953
     Notice: this only affects the external representation of the text."
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   954
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   955
    ^ externalEncoding
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   956
!
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   957
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   958
externalEncoding:encodingSymOrNil
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   959
    "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
   960
     via the 'save / save as' dialog.
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   961
     This is (currently only) passed down from the fileBrowser,
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   962
     and required when  utf8/japanese/chinese/korean text is edited.
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   963
     (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
   964
     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
   965
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   966
    externalEncoding := encodingSymOrNil
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   967
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   968
2581
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   969
parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   970
    "return the value of the instance variable 'parenthesisSpecification' (automatically generated)"
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   971
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   972
    ^ parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   973
!
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   974
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   975
parenthesisSpecification:aDictionary
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   976
    "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
   977
     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
   978
     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
   979
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   980
    parenthesisSpecification := aDictionary
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   981
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   982
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   983
saveAction:something
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   984
    saveAction := something.
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   985
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   986
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   987
searchBarActionBlock
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   988
    ^ searchBarActionBlock
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   989
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   990
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   991
searchBarActionBlock:something
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   992
    searchBarActionBlock := something.
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   993
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   994
3787
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   995
!TextView methodsFor:'accessing-behavior'!
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   996
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   997
isReadOnly
5612
513fa58e4761 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
   998
    "return true, if the text is readonly."
513fa58e4761 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
   999
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  1000
    ^ true
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  1001
!
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  1002
3787
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1003
readOnly:aBoolean
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1004
    "for protocol compatibility with editTextViews,
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1005
     but actually ignored"
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1006
! !
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1007
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1008
!TextView methodsFor:'accessing-contents'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1009
2791
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1010
contents:newContents selected:selectedBoolean
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1011
    self contents:newContents.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1012
    selectedBoolean ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1013
	list size == 1 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1014
	    self selectFromLine:1 col:1 toLine:1 col:(list at:1) size
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1015
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1016
	    self selectAll
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1017
	]
2791
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1018
    ]
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1019
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1020
    "
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1021
     |w|
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1022
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1023
     w := Workspace new open.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1024
     w contents:'Hello world' selected:true.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1025
    "
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1026
!
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1027
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1028
fromFile:aFileName
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1029
    "take contents from a named file"
3724
5db1580f82ba mark obsolete message
Stefan Vogel <sv@exept.de>
parents: 3708
diff changeset
  1030
    <resource: #obsolete>
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1031
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1032
    self obsoleteMethodWarning.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1033
    ^ self loadTextFile:aFileName.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1034
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1035
    "Modified: / 25-10-2006 / 14:47:35 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1036
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1037
4755
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1038
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1039
    "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
  1040
     Redefined since changing the contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1041
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1042
    self unselect.
4755
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1043
    super list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1044
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1045
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1046
loadTextFile:aFileName
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1047
    "take contents from a named file"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1048
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1049
    |f|
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1050
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1051
    f := aFileName asFilename.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1052
    self directoryForFileDialog:(f directoryName).
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1053
    self contents:(f contents)
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1054
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1055
    "Created: / 25-10-2006 / 14:44:01 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1056
!
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1057
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1058
setContents:something
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1059
    "set the contents (either a string or a Collection of strings)
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1060
     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
  1061
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1062
    |selStartLine selStartCol selEndLine selEndCol selStyle|
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
    selStartLine := selectionStartLine.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1065
    selStartCol := selectionStartCol.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1066
    selEndLine := selectionEndLine.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1067
    selEndCol := selectionEndCol.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1068
    selStyle := selectStyle.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1069
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1070
    super setContents:something.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1071
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1072
    selStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1073
	self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1074
	    selectFromLine:selStartLine col:selStartCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1075
	    toLine:selEndLine col:selEndCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1076
	selectStyle := selStyle
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1077
    ].
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1078
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1079
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1080
    "Modified: / 31.3.1998 / 23:33:21 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1081
!
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1082
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1083
setList:something
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1084
    "set the displayed contents (a collection of strings)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1085
     without redraw.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1086
     Redefined since changing contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1087
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1088
    self unselect.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1089
    super setList:something
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1090
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1091
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1092
setupForFile:aFileName
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1093
    "take contents from a named file"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1094
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1095
    |baseName|
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1096
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1097
    self loadTextFile:aFileName.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1098
    aFileName notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1099
	baseName := aFileName asFilename baseName.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1100
	self topView label:baseName.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1101
	self defaultFileNameForFileDialog:baseName.
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1102
    ].
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1103
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1104
    "Created: / 25-10-2006 / 14:47:13 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1105
!
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1106
1487
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1107
text
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1108
    "for ST80 compatibility"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1109
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1110
    ^ self contents
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1111
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1112
    "Created: / 19.4.1998 / 12:53:10 / cg"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1113
!
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1114
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1115
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
  1116
    "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
  1117
     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
  1118
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1119
    |beginCol endCol endLine thisCharacter flag|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1120
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1121
    flag := #word.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1122
    beginCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1123
    endCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1124
    endLine := selectLine.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1125
    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
  1126
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1127
    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
  1128
    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
  1129
    endCol == 0 ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1130
	endLine := selectLine + 1
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1131
    ].
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1132
1750
d87cc464fde2 comment
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1133
    "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
  1134
    (wordCheck value:thisCharacter) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1135
	"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1136
	 try to catch a blank ...
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1137
	"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1138
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1139
	WordSelectCatchesBlanks ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1140
	    ((beginCol == 1)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1141
	    or:[(self characterAtLine:selectLine col:(beginCol - 1))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1142
		 ~~ Character space]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1143
		((self characterAtLine:selectLine col:(endCol + 1))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1144
		  == Character space) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1145
		    endCol := endCol + 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1146
		    flag := #wordRight
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1147
		]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1148
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1149
		beginCol := beginCol - 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1150
		flag := #wordLeft
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1151
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1152
	].
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1153
    ].
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1154
    aFiveArgBlock value:selectLine
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1155
		  value:beginCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1156
		  value:endLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1157
		  value:endCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1158
		  value:flag
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1159
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1160
    "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
  1161
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1162
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1163
!TextView methodsFor:'accessing-look'!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1164
2027
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1165
selectionBackgroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1166
    "return the selection-background color."
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1167
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1168
    ^ selectionBgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1169
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1170
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1171
selectionForegroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1172
    "return the selection-foreground color."
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1173
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1174
    ^ selectionFgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1175
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1176
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1177
selectionForegroundColor:color1 backgroundColor:color2
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1178
    "set both the selection-foreground and cursor background colors.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1179
     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
  1180
     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
  1181
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1182
    selectionFgColor := color1 onDevice:device.
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1183
    selectionBgColor := color2 onDevice:device.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2900
diff changeset
  1184
    self hasSelection ifTrue:[
5087
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
  1185
        self invalidate
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1186
    ]
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1187
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 715
diff changeset
  1188
    "Modified: 29.5.1996 / 16:22:15 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1189
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1190
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1191
!TextView methodsFor:'accessing-mvc'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1192
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1193
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
  1194
    "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
  1195
     and selection. Added for ST-80 compatibility"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1196
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1197
    aspectSym notNil ifTrue:[aspectMsg := aspectSym.
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1198
			     listMsg isNil ifTrue:[listMsg := aspectSym]].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1199
    changeSym notNil ifTrue:[changeMsg := changeSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1200
    listSym notNil ifTrue:[listMsg := listSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1201
    menuSym notNil ifTrue:[menuMsg := menuSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1202
"/    initial notNil ifTrue:[initialSelectionMsg := initial].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1203
    self model:aModel.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1204
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1205
    "Modified: 15.8.1996 / 12:52:54 / stefan"
906
a8b9b481ce70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1206
    "Modified: 2.1.1997 / 16:11:28 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1207
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1208
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1209
!TextView methodsFor:'drag & drop'!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1210
96256221e3af support drag
ca
parents: 2581
diff changeset
  1211
allowDrag:aBoolean
96256221e3af support drag
ca
parents: 2581
diff changeset
  1212
    "enable/disable dragging support
96256221e3af support drag
ca
parents: 2581
diff changeset
  1213
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  1214
    aBoolean ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1215
	dropSource := nil.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1216
    ] ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1217
	dropSource isNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1218
	    dropSource := DropSource
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1219
			    receiver:self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1220
			    argument:nil
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1221
			    dropObjectSelector:#collectionOfDragObjects
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1222
			    displayObjectSelector:nil
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1223
	]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1224
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  1225
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1226
96256221e3af support drag
ca
parents: 2581
diff changeset
  1227
canDrag
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1228
    "returns true if dragging is enabled"
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1229
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1230
    ^ dropSource notNil and:[ self hasSelection ]
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1231
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1232
    "Modified (comment): / 12-02-2012 / 08:37:21 / cg"
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1233
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1234
96256221e3af support drag
ca
parents: 2581
diff changeset
  1235
collectionOfDragObjects
96256221e3af support drag
ca
parents: 2581
diff changeset
  1236
    "returns collection of dragable objects assigned to selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  1237
     Here, by default, a collection of text-dragObjects is generated;
96256221e3af support drag
ca
parents: 2581
diff changeset
  1238
     however, if a dragObjectConverter is defined, that one gets a chance
96256221e3af support drag
ca
parents: 2581
diff changeset
  1239
     to convert as appropriate.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1240
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  1241
    |selection|
96256221e3af support drag
ca
parents: 2581
diff changeset
  1242
96256221e3af support drag
ca
parents: 2581
diff changeset
  1243
    selection := self selection.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1244
96256221e3af support drag
ca
parents: 2581
diff changeset
  1245
    selection size == 0 ifTrue:[^ nil].
5249
cc785134a690 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1246
    ^ Array with:(DropObject newText:selection).
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1247
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1248
96256221e3af support drag
ca
parents: 2581
diff changeset
  1249
dropSource
3245
b17c15b61e94 ugly comments
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  1250
    "returns the dropSource or nil"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1251
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1252
    ^ dropSource
96256221e3af support drag
ca
parents: 2581
diff changeset
  1253
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1254
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1255
dropSource:aDropSourceOrNil
3245
b17c15b61e94 ugly comments
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  1256
    "set the dropSource or nil"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1257
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1258
    dropSource := aDropSourceOrNil.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1259
! !
96256221e3af support drag
ca
parents: 2581
diff changeset
  1260
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1261
!TextView methodsFor:'encoding'!
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
validateFontEncodingFor:newEncoding ask:ask
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1264
    "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
  1265
     which is able to display text encoded as specified by newEncoding"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1266
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1267
    |fontsEncoding msg filter f defaultFont pref matchingFonts
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1268
     matchingFamilyFonts matchingFamilyFaceFonts matchingFamilyFaceStyleFonts
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1269
     matchingFamilyFaceStyleSizeFonts|
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1270
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1271
    fontsEncoding := gc font encoding.
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1272
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1273
    pref := FontDescription preferredFontEncodingFor:newEncoding.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1274
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1275
    (pref match:fontsEncoding) ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1276
        ^ self
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1277
    ].
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1278
    (fontsEncoding notNil and:[CharacterEncoder isEncoding:pref subSetOf:fontsEncoding]) ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1279
        ^ self
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1280
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1281
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1282
    filter := [:f | |coding|
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1283
                    (coding := f encoding) notNil
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1284
                    and:[pref match:coding]].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1285
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1286
    device flushListOfAvailableFonts.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1287
    matchingFonts := device listOfAvailableFonts select:filter.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1288
    matchingFamilyFonts := matchingFonts select:[:f | f family = gc font family].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1289
    matchingFamilyFaceFonts := matchingFamilyFonts select:[:f | f face = gc font face].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1290
    matchingFamilyFaceStyleFonts := matchingFamilyFaceFonts select:[:f | f style = gc font style].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1291
    matchingFamilyFaceStyleSizeFonts := matchingFamilyFaceStyleFonts select:[:f | f size = gc font size].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1292
    matchingFamilyFaceStyleSizeFonts size > 0 ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1293
        defaultFont := matchingFamilyFaceStyleSizeFonts first
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1294
    ] ifFalse:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1295
        matchingFamilyFaceStyleFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1296
            defaultFont := matchingFamilyFaceStyleFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1297
        ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1298
            matchingFamilyFaceFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1299
                defaultFont := matchingFamilyFaceFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1300
            ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1301
                matchingFamilyFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1302
                    defaultFont := matchingFamilyFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1303
                ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1304
                    matchingFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1305
                        defaultFont := matchingFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1306
                    ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1307
                ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1308
            ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1309
        ].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1310
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1311
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1312
    defaultFont isNil ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1313
        defaultFont isNil ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1314
            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
  1315
            pref := #'iso10646-1'.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1316
        ]
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1317
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1318
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1319
    msg := 'Switch to a %1 encoded font ?'.
3189
945a221e5cb2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3045
diff changeset
  1320
    (ask not or:[self confirm:(resources stringWithCRs:msg with:pref)])
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1321
    ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1322
        self withWaitCursorDo:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1323
            f := FontPanel
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1324
                    fontFromUserInitial:defaultFont
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1325
                    title:(resources string:'Font selection')
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1326
                    filter:filter
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1327
                    encoding:pref.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1328
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1329
            f notNil ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1330
                self font:f.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1331
            ]
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1332
        ]
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1333
    ]
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1334
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1335
    "Created: 26.10.1996 / 12:06:54 / cg"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1336
    "Modified: 30.6.1997 / 17:46:46 / cg"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1337
! !
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1338
2752
5650a9ab5935 method category rename
Claus Gittinger <cg@exept.de>
parents: 2744
diff changeset
  1339
!TextView methodsFor:'event handling'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1340
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1341
buttonMotion:buttonState x:x y:y
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1342
    "mouse-move while button was pressed - handle selection changes"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1343
3219
e8c7679a8a94 buttonrelease behavior, when released in another view
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
  1344
    (clickLine isNil or:[clickPos isNil]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1345
	dragIsActive := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1346
	^ self
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1347
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  1348
96256221e3af support drag
ca
parents: 2581
diff changeset
  1349
    dragIsActive ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1350
	(clickPos dist:(x@y)) >= 5.0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1351
	    dragIsActive := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1352
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1353
	    self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1354
		dropSource startDragIn:self at:(x@y)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1355
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1356
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1357
	^ self
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1358
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1359
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1360
    "is it the select or 1-button ?"
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1361
    buttonState == 0 ifTrue:[^ self].
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1362
    self sensor leftButtonPressed ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1363
	"/ self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1364
	"/ self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1365
	^ self
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1366
    ].
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1367
"/    (device buttonMotionMask:buttonState includesButton:#select) ifFalse:[
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1368
"/        (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
  1369
"/            ^ self
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1370
"/        ].
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1371
"/    ].
53
b587b15eafab *** empty log message ***
claus
parents: 45
diff changeset
  1372
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1373
    "if moved outside of view, start autoscroll"
3202
8217b0acc9f2 select from beginning (in editField
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
  1374
4160
a9c329c2784d changed: buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 4156
diff changeset
  1375
    ((y < 0) and:[firstLineShown ~~ 0]) 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 startAutoScrollUp:y negated) 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
    (y > height) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1382
	self compressMotionEvents:false.
5128
787b617a99e5 Merged 52e9f87d45c8 and fcd696f9f401 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5085 5120
diff changeset
  1383
        (self startAutoScrollDown:(y - height)) ifTrue:[
5094
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1384
            ^ self
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1385
        ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1386
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  1387
    ((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1388
	self compressMotionEvents:false.
5094
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1389
        (self startAutoScrollLeft:x) ifTrue:[
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1390
            ^ self
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1391
        ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1392
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1393
    (x > width) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1394
	self compressMotionEvents:false.
5094
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1395
        (self startAutoScrollRight:(x - width)) ifTrue:[
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1396
            ^ self
520a8c202db3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5093
diff changeset
  1397
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1398
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1399
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1400
    "move inside - stop autoscroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1401
    autoScrollBlock notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1402
	self stopScrollSelect
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1403
    ].
3220
246c5a3bfefa oops - leftover prints
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
  1404
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1405
    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
  1406
4160
a9c329c2784d changed: buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 4156
diff changeset
  1407
    "Modified: / 08-08-2010 / 11:20:54 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1408
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1409
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1410
buttonMultiPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1411
    "multi-mouse-click - select word under pointer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1412
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1413
    (button == 1) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1414
	clickPos := x @ y.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1415
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1416
	"/ 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
  1417
"/        self clearSearchAction.
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  1418
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1419
	clickCount notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1420
	    clickCount := clickCount + 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1421
	    (clickCount == 2) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1422
		self doubleClickX:x y:y
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1423
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1424
		(clickCount == 3) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1425
		    self tripleClickX:x y:y
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1426
		] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1427
		    (clickCount == 4) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1428
			self quadClickX:x y:y
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1429
		    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1430
		]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1431
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1432
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1433
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1434
	super buttonMultiPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1435
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1436
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1437
    "Modified: 11.9.1997 / 04:15:35 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1438
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1439
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1440
buttonPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1441
    "mouse-click - prepare for selection change"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1442
1308
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1443
    |sensor clickVisibleLine|
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1444
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1445
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1446
    sensor       := self sensor.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1447
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1448
    (button == 1) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1449
	sensor shiftDown ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1450
	    "mouse-click with shift - adding to selection"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1451
	    self extendSelectionToX:x y:y.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1452
	    ^ self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1453
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1454
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1455
	clickVisibleLine := self visibleLineOfY:y.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1456
	clickPos := x @ y.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1457
	clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1458
	clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1459
	clickStartLine := clickLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1460
	clickStartCol := clickCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1461
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1462
	(self canDrag
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1463
	and:[(self isInSelection:clickLine col:clickCol)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1464
	and:[UserPreferences current startTextDragWithControl not
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1465
	     or:[sensor ctrlDown]]]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1466
	    dragIsActive := true
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1467
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1468
	    self unselect.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1469
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1470
	clickCount := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1471
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1472
	super buttonPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1473
    ]
813
7168eda47e3b Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 770
diff changeset
  1474
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1475
    "Modified: / 20.5.1999 / 17:02:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1476
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1477
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1478
buttonRelease:button x:x y:y
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1479
    "mouse- button release - turn off autoScroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1480
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1481
    (button == 1) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1482
	self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1483
	    self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1484
	    self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1485
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1486
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1487
	autoScrollBlock notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1488
	    self stopScrollSelect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1489
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1490
	dragIsActive ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1491
	    self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1492
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1493
	clickPos := nil.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1494
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1495
	super buttonRelease:button x:x y:y
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1496
    ].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1497
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1498
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1499
    "/ clickPos := clickLine := clickCol := nil.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1500
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1501
    "Modified: / 20.5.1999 / 17:14:23 / cg"
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1502
!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1503
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1504
doubleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1505
    "double-click - select word under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1506
3588
a70267e5b501 st80 behavior: also scan for matching single quote
Claus Gittinger <cg@exept.de>
parents: 3587
diff changeset
  1507
    |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
  1508
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1509
    self selectWordAtX:x y:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1510
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1511
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1512
     special - if clicked on a parenthesis, select to matching
4702
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1513
     (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
  1514
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1515
    ((sel := self selection) size == 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1516
    and:[(sel := sel at:1) size == 1]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1517
	ch := sel at:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1518
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1519
	((self isOpeningParenthesis:ch)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1520
	or:[ (self isClosingParenthesis:ch) ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1521
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1522
		searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1523
		ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1524
			      |prevLine prevCol moveBack pos1|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1525
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1526
			      prevLine := firstLineShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1527
			      prevCol := viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1528
			      self selectFromLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1529
					   toLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1530
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1531
			      self sensor ctrlDown ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1532
				  "/ undo scroll operation ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1533
				  self withCursor:Cursor eye do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1534
				      |delayCount|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1535
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1536
				      moveBack := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1537
				      (self isClosingParenthesis:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1538
					   (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1539
					       moveBack := true
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
				      ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1542
					   selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1543
					       self makeLineVisible:selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1544
					       moveBack := true
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
				      ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1547
				      moveBack ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1548
					   delayCount  := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1549
					   pos1 := x@y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1550
					   self invalidateRepairNow:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1551
					   Delay waitForSeconds:MatchDelayTime.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1552
					   delayCount := delayCount + MatchDelayTime.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1553
					   [self sensor hasUserEventFor:self] whileFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1554
						Delay waitForSeconds:MatchDelayTime / 2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1555
						delayCount := delayCount + (MatchDelayTime / 2).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1556
						delayCount > 2 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1557
						    self cursor:Cursor eyeClosed.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1558
						].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1559
						delayCount >= 2.3 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1560
						    self cursor:Cursor eye.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1561
						    delayCount := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1562
						]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1563
					   ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1564
					   self scrollToLine:prevLine; scrollToCol:prevCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1565
				      ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1566
				  ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1567
			      ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1568
			      ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1569
			  ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1570
		ifNotFound:[self showNotFound]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1571
		onError:[self beep]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1572
		openingCharacters:((parenthesisSpecification at:#open) ", '([{'")
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1573
		closingCharacters:((parenthesisSpecification at:#close) ", ')]}'").
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1574
	    selectStyle := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1575
	]
4702
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1576
    ].
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1577
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1578
    (self st80SelectMode or:[ self sensor ctrlDown]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1579
	"/ st80 selects:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1580
	"/   - 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
  1581
	"/   - 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
  1582
	"/   - 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
  1583
	"/   - 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
  1584
	"/ 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
  1585
	clickCol == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1586
	    clickLine == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1587
		self selectAll.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1588
		^ self.
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
	    self selectLineAtY:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1591
	    selectStyle := #line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1592
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1593
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1594
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1595
	matchCol := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1596
	"/ see what is to the left of that character ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1597
	clickCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1598
	    ch := self characterAtLine:clickLine col:clickCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1599
	    (self isOpeningParenthesis:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1600
		matchCol := clickCol - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1601
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1602
		('"''|' includes:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1603
		    scanCol := clickCol - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1604
		    fwdScan := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1605
		    scanCh := ch.
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
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1608
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1609
	fwdSelect := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1610
	(matchCol isNil and:[scanCol isNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1611
	    clickCol < (self listAt:clickLine) size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1612
		ch := self characterAtLine:clickLine col:clickCol+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1613
		(self isClosingParenthesis:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1614
		    matchCol := clickCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1615
		    fwdSelect := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1616
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1617
		    ('"''|' includes:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1618
			scanCol := clickCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1619
			fwdScan := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1620
			scanCh := ch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1621
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1622
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1623
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1624
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1625
	matchCol notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1626
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1627
		searchForMatchingParenthesisFromLine:clickLine col:matchCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1628
		ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1629
			  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
  1630
				       toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1631
		ifNotFound:[self showNotFound]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1632
		onError:[self beep]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1633
		openingCharacters:((parenthesisSpecification at:#open) , '([{')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1634
		closingCharacters:((parenthesisSpecification at:#close) , ')]}').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1635
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1636
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1637
	scanCol notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1638
	    "/ if its an EOL comment, do it differently
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1639
	    ch := self characterAtLine:clickLine col:clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1640
	    ch == $/ ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1641
		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
  1642
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1643
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1644
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1645
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1646
		scanFor:scanCh fromLine:clickLine col:scanCol forward:fwdScan
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1647
		ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1648
			    |selStart selEnd|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1649
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1650
			    fwdScan ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1651
				selStart := scanCol+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1652
				selEnd := col-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1653
			    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1654
				selStart := scanCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1655
				selEnd := col+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1656
			    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1657
			    self selectFromLine:clickLine col:selStart
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1658
				 toLine:line col:selEnd.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1659
			    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1660
			   ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1661
		ifNotFound:[self showNotFound].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1662
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1663
	]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1664
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1665
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
     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
  1668
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1669
    wordStartLine := selectionStartLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1670
    wordEndLine := selectionEndLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1671
    selectStyle == #wordLeft ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1672
	wordStartCol := selectionStartCol + 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1673
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1674
	wordStartCol := selectionStartCol.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1675
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1676
    selectStyle == #wordRight ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1677
	wordEndCol := selectionEndCol - 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1678
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1679
	wordEndCol := selectionEndCol
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1680
    ]
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1681
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  1682
    "Created: / 11-09-1997 / 04:12:55 / cg"
4255
9bf0cc2595a9 changed: #doubleClickX:y:
Claus Gittinger <cg@exept.de>
parents: 4254
diff changeset
  1683
    "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
  1684
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1685
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1686
extendSelectionToX:x y:y
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1687
    "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
  1688
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1689
    self extendSelectionToX:x y:y setPrimarySelection:true
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1690
!
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1691
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1692
extendSelectionToX:x y:y setPrimarySelection:aBoolean
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1693
    "mouse-move while button was pressed - handle selection changes"
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1694
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1695
    |movedVisibleLine movedLine movedCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1696
     movedUp
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1697
     oldStartLine oldEndLine oldStartCol oldEndCol|
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1698
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1699
    movedVisibleLine := self visibleLineOfY:y.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1700
    movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1701
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1702
    (x < leftMargin) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1703
	movedCol := 0
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1704
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1705
	movedCol := self colOfX:x inVisibleLine:movedVisibleLine
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1706
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1707
    y < 0 ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1708
	movedCol := 0
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1709
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1710
    ((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1711
	selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1712
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1713
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1714
	(clickPos isNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1715
	or:[(clickPos x - x) abs < 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1716
	    and:[(clickPos y - y) abs < 3]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1717
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1718
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1719
	selectionStartLine := clickLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1720
	selectionStartCol := clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1721
	selectionEndLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1722
	selectionEndCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1723
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1724
	oldStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1725
	oldEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1726
	oldStartCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1727
	oldEndCol := selectionEndCol-1.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1728
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1729
	selectionStartLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1730
	    selectionStartLine := selectionEndLine := clickLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1731
	    selectionStartCol := selectionEndCol := clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1732
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1733
	oldStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1734
	oldEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1735
	oldStartCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1736
	oldEndCol := selectionEndCol.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1737
    ].
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1738
    oldEndLine isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1739
	oldEndLine := selectionEndLine ? clickLine ? movedLine.
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1740
    ].
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1741
    oldEndCol isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1742
	oldEndCol := selectionEndCol ? clickCol.
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
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
    "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
  1746
    movedUp := false.
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1747
    clickStartLine isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1748
	clickStartLine := movedLine.
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1749
    ].
3505
cdb364dede3e extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
  1750
    clickStartCol isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1751
	clickStartCol := movedCol.
3505
cdb364dede3e extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
  1752
    ].
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1753
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1754
    (movedLine < clickStartLine) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1755
	movedUp := true
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
	(movedLine == clickStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1758
	    (movedCol < clickStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1759
		movedUp := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1760
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1761
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1762
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1763
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1764
    movedUp ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1765
	"change selectionStart"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1766
	selectionStartCol := movedCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1767
	selectionStartLine := movedLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1768
	selectionEndCol := clickStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1769
	selectionEndLine := clickStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1770
	selectStyle notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1771
	    selectionEndCol := wordEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1772
	    selectionEndLine := wordEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1773
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1774
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1775
	"change selectionEnd"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1776
	selectionEndCol := movedCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1777
	selectionEndLine := movedLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1778
	selectionStartCol := clickStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1779
	selectionStartLine := clickStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1780
	selectStyle notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1781
	    selectionStartCol := wordStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1782
	    selectionStartLine := wordStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1783
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1784
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1785
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1786
    selectionStartLine isNil ifTrue:[^ self].
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
    (selectionStartCol == 0) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1789
	selectionStartCol := 1
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1790
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1791
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1792
    "
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1793
     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
  1794
    "
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1795
    (selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1796
	movedUp ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1797
	    selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1798
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1799
	    selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1800
	    selectionEndCol == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1801
		selectionEndLine := selectionEndLine + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1802
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1803
	].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1804
    ].
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
    selectStyle == #line ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1807
	movedUp ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1808
	    selectionStartCol := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1809
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1810
	    selectionEndCol := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1811
	    selectionEndLine := selectionEndLine + 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
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1814
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1815
    self validateNewSelection.
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1816
    aBoolean ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1817
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1818
	self selectionChanged.
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1819
    ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1820
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  1821
    "/ 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
  1822
"/    self clearSearchAction.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1823
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1824
    (oldStartLine == selectionStartLine) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1825
	(oldStartCol ~~ selectionStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1826
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1827
		redrawLine:oldStartLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1828
		      from:((selectionStartCol min:oldStartCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1829
			to:((selectionStartCol max:oldStartCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1830
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1831
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1832
	self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1833
	    redrawFromLine:(oldStartLine?selectionStartLine min:selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1834
			to:(oldStartLine?selectionStartLine max:selectionStartLine)
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
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1837
    (oldEndLine == selectionEndLine) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1838
	(oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1839
	    self redrawLine:oldEndLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1840
		       from:((selectionEndCol min:oldEndCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1841
			 to:((selectionEndCol max:oldEndCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1842
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1843
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1844
	selectionEndLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1845
	    selectionStartLine := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1846
	    self redraw.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1847
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1848
	    (selectionStartLine notNil) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1849
		self redrawFromLine:(oldEndLine min:selectionEndLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1850
				 to:(oldEndLine max:selectionEndLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1851
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1852
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1853
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1854
    clickLine := movedLine.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1855
    clickCol := movedCol
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1856
4234
65f202270d2c changed: #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 4178
diff changeset
  1857
    "Modified: / 05-04-2011 / 17:13:35 / cg"
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  1858
    "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
  1859
!
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1860
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1861
keyPress:key x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1862
    "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
  1863
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1864
    <resource: #keyboard (#Find #Copy #FindNext #FindPrev #FindAgain
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1865
			  #GotoLine #SelectAll #SaveAs #Print
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1866
			  #'F*' #'f*' #ZoomIn #ZoomOut)>
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1867
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1868
    (key == #Find) ifTrue:[self search. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1869
    (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
  1870
    (key == #GotoLine) ifTrue:[self gotoLine. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1871
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1872
    (key == #FindNext) ifTrue:[self searchFwd. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1873
    (key == #FindPrev) ifTrue:[self searchBwd. ^self].
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1874
    (key == #FindAgain) ifTrue:[self searchAgainInSameDirection. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1875
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1876
    (key == #SelectAll) ifTrue:[self selectAll. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1877
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1878
    (key == #SaveAs)    ifTrue:[self save.    ^self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1879
    (key == #Print)     ifTrue:[self doPrint. ^self].
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  1880
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1881
    (key == #ZoomIn or:[key == #ZoomOut]) ifTrue:[ self fontLargerOrSmaller:(key == #ZoomIn) ].
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1882
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1883
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1884
     shift-Fn defines a key-sequence
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1885
     Fn       pastes that sequence
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1886
     cmd-Fn   performs a 'doIt' on the sequence (Workspaces only)
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
     (see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1889
    "
1193
811135bbd017 Do not crash when typing simple keys.
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
  1890
    (key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1891
	(('[fF][0-9]' match:key)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1892
	or:['[fF][0-9][0-9]' match:key]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1893
	    self sensor shiftDown ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1894
		UserPreferences current functionKeySequences
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1895
		    at:key put:(self selection)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1896
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1897
	    ^ self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1898
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1899
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1900
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1901
    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
  1902
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1903
    "Modified: / 18-04-1997 / 12:12:27 / stefan"
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1904
    "Modified: / 10-03-2012 / 09:40:01 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1905
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1906
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1907
mapped
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1908
    super mapped.
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1909
    selectionFgColor := selectionFgColor onDevice:device.
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1910
    selectionBgColor := selectionBgColor onDevice:device.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1911
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1912
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1913
quadClickX:x y:y
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1914
    "quadrupleClick-click - select all"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1915
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1916
    self selectAll
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1917
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1918
    "Created: / 11.9.1997 / 04:15:24 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1919
    "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
  1920
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1921
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1922
tripleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1923
    "triple-click - select line under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1924
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1925
    self selectLineAtY:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1926
    selectStyle := #line
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1927
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1928
    "Created: 11.9.1997 / 04:13:37 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1929
! !
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1930
2120
1054ce5c8fe7 category change
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
  1931
!TextView methodsFor:'initialization & release'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1932
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1933
fetchDeviceResources
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1934
    "fetch device colors, to avoid reallocation at redraw time"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1935
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1936
    super fetchDeviceResources.
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1937
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1938
    selectionFgColor notNil ifTrue:[selectionFgColor := selectionFgColor onDevice:device].
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1939
    selectionBgColor notNil ifTrue:[selectionBgColor := selectionBgColor onDevice:device].
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1940
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1941
    "Created: 14.1.1997 / 00:14:33 / cg"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1942
!
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1943
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1944
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1945
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1946
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1947
    super initStyle.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1948
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1949
    viewBackground := DefaultViewBackground.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1950
    selectionFgColor := DefaultSelectionForegroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1951
    selectionFgColor isNil ifTrue:[selectionFgColor := bgColor].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1952
    selectionBgColor := DefaultSelectionBackgroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1953
    selectionBgColor isNil ifTrue:[
5649
6f57a64ccaa1 Replace all `self graphicsDevice` with `device`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5616
diff changeset
  1954
	device hasColors ifTrue:[
5099
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1955
            DefaultSelectionForegroundColor isNil ifTrue:[
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1956
                selectionFgColor := fgColor
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1957
            ].
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1958
            selectionBgColor := Color green
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1959
        ] ifFalse:[
5649
6f57a64ccaa1 Replace all `self graphicsDevice` with `device`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5616
diff changeset
  1960
	    device hasGrayscales ifTrue:[
5099
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1961
                DefaultSelectionForegroundColor isNil ifTrue:[
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1962
                    selectionFgColor := fgColor
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1963
                ].
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1964
                selectionBgColor := Color gray
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1965
            ] ifFalse:[
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1966
                selectionBgColor := fgColor
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1967
            ]
1af2798f1150 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5094
diff changeset
  1968
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1969
    ].
708
e8eb52699f90 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  1970
4321
4c8c94f6e1c6 comemnt in: #initStyle
az
parents: 4310
diff changeset
  1971
    "Modified: / 22-01-1997 / 11:57:53 / cg"
4c8c94f6e1c6 comemnt in: #initStyle
az
parents: 4310
diff changeset
  1972
    "Modified (comment): / 05-10-2011 / 15:50:45 / az"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1973
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1974
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1975
initialize
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1976
    super initialize.
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1977
    self initializeSaveAction.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1978
    contentsWasSaved := false.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1979
    dragIsActive     := false.
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  1980
    lastSearchWasMatch := lastSearchWasVariableSearch := false.
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  1981
    lastSearchIgnoredCase := true.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1982
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1983
    parenthesisSpecification isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1984
	parenthesisSpecification := DefaultParenthesisSpecification.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1985
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1986
911
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1987
    "I handle menus myself"
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1988
    menuHolder := menuPerformer := self.
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1989
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1990
    "/ on default allow drag
96256221e3af support drag
ca
parents: 2581
diff changeset
  1991
    self allowDrag:true.
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1992
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1993
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1994
initializeSaveAction
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1995
    saveAction := [ self openSaveDialog ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1996
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1997
4450
ef24b9b60ec1 category of:21 methods
Claus Gittinger <cg@exept.de>
parents: 4437
diff changeset
  1998
!TextView methodsFor:'menu & menu actions'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1999
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2000
appendTo:aFileName
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2001
    "append contents to a file named fileName"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2002
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2003
    |aStream msg filename|
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2004
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2005
    filename := aFileName asFilename.
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2006
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2007
    (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2008
	msg := resources string:'Refused to append to file ''%1'' !!' with:filename name.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2009
	self warn:(msg , '\\(ST/X internal permission check)' ) withCRs.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2010
	^ self
2036
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  2011
    ].
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  2012
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2013
    [
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2014
	aStream := filename appendingWriteStream.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2015
	[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2016
	    self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2017
	] ensure:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2018
	    aStream close.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2019
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2020
	contentsWasSaved := true
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2021
    ] on:FileStream openErrorSignal do:[:ex|
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2022
	msg := resources string:'cannot append to file %1 !!' with:filename name.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2023
	self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2024
    ]
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2025
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2026
    "Modified: / 27-07-2012 / 09:41:18 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2027
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2028
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2029
changeFont
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2030
    "pop up a fontPanel to change font"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2031
5676
20a8f1c87323 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5675
diff changeset
  2032
    |newFont fp userPrefs fontPrefs newFontPrefs|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2033
5005
2acadbbf1bce class: TextView
Claus Gittinger <cg@exept.de>
parents: 5004
diff changeset
  2034
    self withWaitCursorDo:[
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2035
        fp := FontPanel new.
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2036
        fp withChangeFontInViewsAllCheckBox:true.
5552
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5550 5547
diff changeset
  2037
        newFont := fp fontFromUserInitial:self font.
5005
2acadbbf1bce class: TextView
Claus Gittinger <cg@exept.de>
parents: 5004
diff changeset
  2038
    ].
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2039
    newFont notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2040
	self font:newFont.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2041
        fp changeFontInAllViews ifTrue:[
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2042
            "/ user checked this box - change the defaults,
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2043
            "/ and update all other textviews now.
5676
20a8f1c87323 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5675
diff changeset
  2044
            userPrefs := UserPreferences current.
20a8f1c87323 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5675
diff changeset
  2045
            fontPrefs := userPrefs fontPreferences.
20a8f1c87323 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5675
diff changeset
  2046
            fontPrefs isNil ifTrue:[ fontPrefs := newFontPrefs := Dictionary new ].
5675
7bf31ecf9aa3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5658
diff changeset
  2047
            
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2048
            TextView defaultFont:newFont.
5676
20a8f1c87323 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5675
diff changeset
  2049
            fontPrefs at:#Text put:(newFont storeString).
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2050
            newFontPrefs notNil ifTrue:[ userPrefs fontPreferences:newFontPrefs ].
5676
20a8f1c87323 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5675
diff changeset
  2051
            userPrefs beModified.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2052
            DebugView newDebugger.
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2053
            TextView allSubInstances do:[:v |
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2054
                v font:newFont
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2055
            ].    
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2056
        ].    
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2057
    ]
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2058
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2059
    "Modified: 27.2.1996 / 00:53:51 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2060
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2061
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2062
copySelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2063
    "copy contents into smalltalk copybuffer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2064
863
ed4282df00a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
  2065
    |text|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2066
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2067
    text := self selection.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2068
    text notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2069
	self unselect.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2070
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2071
	"/ forget any emphasis ...
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2072
	text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2073
	self setClipboardText:text.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2074
    ]
649
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  2075
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  2076
    "Modified: 17.5.1996 / 08:57:54 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2077
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2078
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2079
defaultForGotoLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2080
    "return a default value to show in the gotoLine box"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2081
447
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2082
    ^ selectionStartLine
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2083
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2084
    "Modified: 1.3.1996 / 18:44:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2085
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2086
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2087
doPrint
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2088
    "print the contents on the printer"
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2089
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2090
    |printStream|
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2091
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2092
    list isNil ifTrue:[^ self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2093
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2094
    self withWaitCursorDo:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2095
	printStream := Printer new.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2096
	printStream supportsContext ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2097
	    printStream printerContext font:(self font).
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2098
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2099
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2100
	Printer writeErrorSignal handle:[:ex |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2101
	    self warn:('error while printing:\\'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2102
			, ex description
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2103
			, '\\(printing with: ' , (Printer printCommand) , ')') withCRs
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2104
	] do:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2105
	    self fileOutContentsOn:printStream.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2106
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2107
	printStream close
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2108
    ].
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2109
4363
4ed2feefc2c2 changed: #doPrint
Claus Gittinger <cg@exept.de>
parents: 4361
diff changeset
  2110
    "Created: / 06-05-1996 / 16:11:26 / cg"
4ed2feefc2c2 changed: #doPrint
Claus Gittinger <cg@exept.de>
parents: 4361
diff changeset
  2111
    "Modified: / 31-01-2012 / 18:16:39 / cg"
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2112
!
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2113
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2114
editMenu
1109
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  2115
    "return my popUpMenu"
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  2116
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  2117
    <resource: #keyboard (#Copy #Find #GotoLine #SaveAs #Print)>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  2118
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  2119
1545
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2120
    |items m|
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2121
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2122
    items := #(
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2123
			('Copy'          copySelection  Copy)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2124
			('-'             nil            )
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2125
			('Search...'     search         Find)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2126
			('Goto Line...'  gotoLine       GotoLine)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2127
			('-'             nil            )
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2128
			('Font...'       changeFont     )
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2129
			('-'             nil            )
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2130
			('Save As...'    save           SaveAs)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2131
			('Print'         doPrint        Print)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2132
		).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2133
1545
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2134
    m := PopUpMenu itemList:items resources:resources.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2135
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2136
    self hasSelectionForCopy ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2137
	m disable:#copySelection.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2138
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2139
    ^ m
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  2140
2458
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  2141
    "Modified: / 12.11.2001 / 13:43:56 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2142
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2143
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2144
find
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2145
    "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
  2146
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2147
    self search
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2148
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2149
    "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
  2150
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2151
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2152
fontLargerOrSmaller:largerBoolean
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2153
    |newFont|
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2154
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2155
    newFont := gc font asSize:(largerBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2156
			    ifTrue:[gc font size + 1]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2157
			    ifFalse:[(gc font size-1) max:4]).
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2158
    self font:newFont.
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2159
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2160
    "Modified: / 27-02-1996 / 00:53:51 / cg"
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2161
    "Created: / 10-03-2012 / 09:38:32 / cg"
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2162
!
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2163
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2164
gotoLine
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2165
    "show a box to enter lineNumber for positioning;
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2166
     The entered number may be prefixed by a + or -;
1926
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  2167
     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
  2168
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  2169
    |l lineNumberBox input lineToGo relative|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2170
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2171
    lineNumberBox :=
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2172
	EnterBox
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2173
	   title:(resources string:'Line number (or +/- relativeNr):')
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2174
	   okText:(resources string:'Goto')
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2175
	   abortText:(resources string:'Cancel')
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2176
	   action:[:l | input := l].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2177
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2178
    l := self defaultForGotoLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2179
    l notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2180
	l := l printString
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2181
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2182
    lineNumberBox initialText:l .
3394
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
  2183
    lineNumberBox label:(resources string:'Goto Line').
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2184
    lineNumberBox showAtPointer.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2185
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2186
    input size > 0 ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2187
	input := input withoutSpaces.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2188
	input size > 0 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2189
	    (input startsWith:$+) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2190
		relative := 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2191
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2192
		(input startsWith:$-) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2193
		    relative := -1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2194
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2195
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2196
	    relative notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2197
		input := input copyFrom:2.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2198
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2199
	    lineToGo := Integer readFromString:input onError:nil.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2200
	    lineToGo notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2201
		relative notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2202
		    lineToGo := self currentLine + (lineToGo * relative)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2203
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2204
		self gotoLine:lineToGo
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2205
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2206
	]
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2207
    ].
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2208
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2209
    "Modified: / 17.5.1998 / 20:07:59 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2210
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2211
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2212
openSaveDialog
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2213
    "Ask user for filename using a fileSelectionBox
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2214
     and save contents into that file."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2215
2695
7e13db2802df better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
  2216
    Dialog
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2217
	requestSaveFileName:(resources string:'Save contents in:')
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2218
	default:defaultFileNameForFileDialog
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2219
	fromDirectory:directoryForFileDialog
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2220
	action:[:fileName | self saveAs:fileName]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2221
	appendAction:[:fileName | self appendTo:fileName]
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2222
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2223
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2224
openSearchBoxAndSearch
5736
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2225
    "search for a string - show a box to enter searchpattern.
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2226
     TODO: this started as an ad-hoc box, which is manually constructed.
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2227
     over time, it got more and more functions, so a separate appModel class
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2228
     would no be appropriate..."
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2229
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2230
    "
4985
414cb5cbe48f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4885
diff changeset
  2231
     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
  2232
     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
  2233
    "
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2234
    |searchBox patternHolder caseHolder matchHolder matchWithRegexHolder wrapAtEndHolder
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2235
     fwd ign match initialString
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2236
     bindings bldr doSearch modal searchVariableHolder selectedVariable searchFullWordHolder selectLinesHolder
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2237
     replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2238
     replaceAllBooleanHolder replacePreserveCaseBooleanHolder
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2239
     searchAtBeginOfLineOnlyHolder updateReturnKeyBehavior|
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2240
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2241
    searchBarActionBlock notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2242
	self resetVariablesBeforeNewSearch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2243
	searchBarActionBlock value:#search value:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2244
	^ self
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2245
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2246
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2247
    modal := (UserPreferences current searchDialogIsModal).   "/ that's experimental
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2248
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2249
    (searchBox := self objectAttributeAt:#currentModelessSearchBox) notNil ifTrue:[
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2250
        (modal not
5735
5fbcb3739f7c #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5734
diff changeset
  2251
        and:[ searchBox window realized ]) ifTrue:[
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2252
            "/ reuse it.
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
  2253
            searchBox window 
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
  2254
                raiseDeiconified;
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
  2255
                requestFocus;
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
  2256
                assignKeyboardFocusToFirstKeyboardConsumer.
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2257
            ^ self.
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2258
        ].    
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2259
        searchBox closeRequest.
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2260
    ].
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2261
    
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2262
    ign := lastSearchIgnoredCase "? LastSearchIgnoredCase " ? true.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2263
    caseHolder := ign not asValue.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2264
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2265
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2266
    matchHolder := match asValue.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2267
    matchWithRegexHolder := (LastSearchWasMatchWithRegex ? false) asValue.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2268
    wrapAtEndHolder := (LastSearchWasWrapAtEndOfText ? false) asValue.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2269
    searchVariableHolder := (lastSearchWasVariableSearch ? false) asValue.
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2270
    searchFullWordHolder := false asValue.
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2271
    searchAtBeginOfLineOnlyHolder := false asValue.
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2272
    selectLinesHolder := false asValue.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2273
    replaceBooleanHolder := ("LastSearchWasReplace ?" false) asValue.
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2274
    replaceAllBooleanHolder := false asValue.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2275
    replacePreserveCaseBooleanHolder := false asValue.
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2276
    replaceTextHolder := (LastSearchReplacedString ? '') asValue.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2277
    replaceBooleanEnabledHolder := self isReadOnly not asValue.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2278
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2279
    patternHolder := '' asValue.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2280
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2281
    self setSearchPatternWithMatchEscapes: match.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2282
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2283
    lastSearchPattern notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2284
	initialString := lastSearchPattern.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2285
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2286
"/  No longer force the current selection to be the initialString
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2287
"/    self hasSelectionWithinSingleLine ifTrue:[
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2288
"/        initialString := self selection asString.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2289
"/    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2290
    initialString isNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2291
	LastSearchPatterns size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2292
	    initialString := LastSearchPatterns first.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2293
	]
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2294
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2295
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2296
    initialString notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2297
	patternHolder value:initialString.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2298
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2299
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2300
    fwd := true.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2301
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2302
    doSearch := [:fwd |
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2303
	|isVariableSearch pattern searchAction|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2304
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2305
	self resetVariablesBeforeNewSearch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2306
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2307
	isVariableSearch := self searchVariableVisible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2308
				and:[searchVariableHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2309
				and:[selectedVariable notNil]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2310
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2311
	isVariableSearch ifTrue:[
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2312
            searchAction := 
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2313
                [
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2314
                    self searchVariableWithSyntaxElement:selectedVariable forward:fwd
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2315
                ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2316
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2317
	    lastSearchWasVariableSearch := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2318
	    LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2319
	    LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2320
            LastSearchWasMatchWithRegex := matchWithRegexHolder value.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2321
            LastSearchWasWrapAtEndOfText := wrapAtEndHolder value.
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2322
            LastSearchWasReplace :=replaceBooleanHolder value.
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2323
            LastSearchReplacedString := replaceTextHolder value.
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2324
            
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2325
	    pattern := patternHolder value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2326
	    pattern notEmptyOrNil ifTrue:[
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2327
                searchAction := 
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2328
                    [
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2329
                        self searchUsingSpec:(
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2330
                            self class searchSpec new
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2331
                                pattern:pattern
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2332
                                ignoreCase:lastSearchIgnoredCase
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2333
                                match: lastSearchWasMatch 
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2334
                                regexMatch:matchWithRegexHolder value 
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2335
                                variable: searchVariableHolder value
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2336
                                fullWord: searchFullWordHolder value
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2337
                                forward:fwd
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2338
                                atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2339
                                wrapAtEnd:wrapAtEndHolder value).
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2340
                    ]
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2341
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2342
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2343
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2344
	replaceBooleanHolder value ifTrue:[
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2345
            |selStart replacement replaceAction|
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2346
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2347
            replacement := replaceTextHolder value.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2348
	    isVariableSearch ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2349
		"/ must replace from the end towards beginning,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2350
		"/ because syntax-elements do not update their position, when
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2351
		"/ the text is changed (in replace).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2352
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2353
		selectedVariable := selectedVariable lastElementInChain.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2354
		self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2355
                searchAction := 
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2356
                    [
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2357
                        selectedVariable := selectedVariable previousElement.
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2358
                        selectedVariable notNil ifTrue:[
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2359
                            self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2360
                        ].
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2361
                        "/ self searchVariableWithSyntaxElement:selectedVariable forward:false
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2362
                    ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2363
	    ].
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2364
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2365
            replaceAction := [ self replace:replacement ]. "/ not implemented here, but in subclasses
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2366
            replacePreserveCaseBooleanHolder value ifTrue:[
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2367
                replaceAction := [
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2368
                    self selectionAsString isUppercaseFirst ifTrue:[
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2369
                        self replace:replacement asUppercaseFirst
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2370
                    ] ifFalse:[
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2371
                        self replace:replacement asLowercaseFirst
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2372
                    ]
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2373
                ].    
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2374
            ].    
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2375
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2376
	    selStart := self characterPositionOfSelection.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2377
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2378
            replaceAction value.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2379
	    searchAction value.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2380
            
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2381
            replaceAllBooleanHolder value ifTrue:[
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2382
                [self characterPositionOfSelection ~= selStart] whileTrue:[
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2383
                    selStart := self characterPositionOfSelection.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2384
                    replaceAction value.
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2385
                    searchAction value.
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2386
                ]
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2387
            ]
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2388
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2389
	    searchAction value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2390
	].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2391
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2392
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2393
    bindings := IdentityDictionary new.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2394
    bindings at:#searchPattern put:patternHolder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2395
    modal ifTrue:[
5736
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2396
        bindings 
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2397
            at:#nextAction 
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2398
            put:[
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2399
                replaceAllBooleanHolder value ifTrue:[
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2400
                    searchBox doAccept.
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2401
                ] ifFalse:[
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2402
                    doSearch value:true
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2403
                ]    
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2404
            ].
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2405
        bindings
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2406
            at:#prevAction 
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2407
            put:[
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2408
                replaceAllBooleanHolder value ifTrue:[
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2409
                    fwd := false. searchBox doAccept.
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2410
                ] ifFalse:[
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2411
                    doSearch value:false
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2412
                ]    
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2413
            ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2414
    ] ifFalse:[
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2415
        bindings at:#nextAction put:[doSearch value:true.].
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2416
        bindings at:#prevAction put:[doSearch value:false.].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2417
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2418
    bindings at:#caseSensitive put:caseHolder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2419
    bindings at:#match put:matchHolder.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2420
    bindings at:#matchWithRegex put:matchWithRegexHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2421
    Regex::RxMatcher isNil ifTrue:[
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2422
        bindings at:#matchWithRegexVisible put:false.
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2423
    ] ifFalse:[
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2424
        bindings at:#matchWithRegexVisible put:matchHolder
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2425
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2426
    bindings at:#patternList put:LastSearchPatterns.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2427
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2428
    self supportsSyntaxElements ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2429
	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
  2430
    ] ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2431
	bindings at:#searchVariableVisible put:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2432
	selectedVariable := self syntaxElementForSelectedVariable.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2433
	bindings at:#searchVariableEnabled put:(selectedVariable notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2434
	selectedVariable notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2435
	    bindings
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2436
		at:#stringWithVariableUnderCursorHolder
5280
de11c20946ee class: TextView
Claus Gittinger <cg@exept.de>
parents: 5276
diff changeset
  2437
                put:(resources string:'Variable ("%1")' with:selectedVariable name).
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2438
            "/ searchVariableHolder value:true.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2439
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2440
	    bindings
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2441
		at:#stringWithVariableUnderCursorHolder
5262
1f4b4b257010 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5249
diff changeset
  2442
                put:(resources string:'Variable (none selected)').
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2443
	].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2444
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2445
    bindings at:#searchVariable put:searchVariableHolder.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2446
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2447
    bindings at:#searchFullWord put:searchFullWordHolder.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2448
    bindings at:#searchFullWordEnabled put:true.
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2449
    bindings at:#searchAtBeginOfLineOnly put:searchAtBeginOfLineOnlyHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2450
    bindings at:#wrapAtEndOfTextHolder put:wrapAtEndHolder.
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2451
    bindings at:#selectLinesHolder put:selectLinesHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2452
    
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2453
    bindings at:#replaceEnabled put:replaceBooleanEnabledHolder.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2454
    bindings at:#replaceBoolean put:replaceBooleanHolder.
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2455
    bindings at:#replaceAllBoolean put:replaceAllBooleanHolder.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2456
    bindings at:#replacePreserveCaseBoolean put:replacePreserveCaseBooleanHolder.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2457
    bindings at:#replaceTextHolder put:replaceTextHolder.
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2458
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2459
    bindings at:#flyByHelpSpec put:self class flyByHelpSpec.
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2460
    
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2461
    updateReturnKeyBehavior :=
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2462
        [
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2463
            |lbl returnAction|
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2464
            
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2465
            "/ when replacing, do not close box on return    
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2466
            replaceBooleanHolder value ifTrue:[
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2467
                lbl := 'Close'.
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2468
                returnAction := searchAction.        
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2469
            ] ifFalse:[
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2470
                lbl := 'Cancel'.
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2471
                returnAction := nil.        
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2472
            ].
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2473
            (bldr componentAt:#cancelButton) label:(resources string:lbl).
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2474
            searchBox window keyboardProcessor returnAction:returnAction.        
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2475
        ].
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2476
    
5010
ad4a10879e16 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5005
diff changeset
  2477
    replaceBooleanHolder onChangeEvaluate:
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2478
	[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2479
	    replaceBooleanHolder value ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2480
		(bldr componentAt:#ReplaceEntryField) requestFocus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2481
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2482
		(bldr componentAt:#patternComboBox) requestFocus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2483
	    ].
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2484
            updateReturnKeyBehavior value.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2485
	].
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2486
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2487
    modal ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2488
	searchBox := SimpleDialog new.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2489
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2490
	searchBox := ApplicationModel new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2491
	searchBox createBuilder.
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2492
        bindings at:#cancel put:[ searchBox closeRequest ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2493
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2494
    searchBox resources:(self resources).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2495
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2496
    bldr := searchBox builder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2497
    bldr addBindings:bindings.
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2498
    bldr aspectAt:#flyByHelpSpec put:(self class flyByHelpSpec).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2499
    searchBox allButOpenFrom:(self class searchDialogSpec).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2500
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2501
    (bldr componentAt:#nextButton) cursor:(Cursor thumbsUp).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2502
    (bldr componentAt:#prevButton) cursor:(Cursor thumbsUp).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2503
    (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2504
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2505
    modal ifTrue:[
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2506
        updateReturnKeyBehavior value.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2507
        searchBox openDialogAtPointer.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2508
	searchBox accepted ifTrue:[ doSearch value:fwd ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2509
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2510
	(bldr componentAt:#nextButton) isReturnButton:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2511
	(bldr componentAt:#cancelButton)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2512
		label:(resources string:'Close');
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2513
		action:[searchBox closeRequest].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2514
	"/ searchBox masterApplication:self application.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2515
	self topView beMaster.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2516
	searchBox window
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2517
		beSlave;
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2518
                openInGroup:(self windowGroup);
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2519
                waitUntilVisible;
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2520
                assignKeyboardFocusToFirstKeyboardConsumer.
5736
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2521
        searchBox window keyboardProcessor        
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2522
            addAccelerator:#Return action:(bindings at:#nextAction);
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2523
            addAccelerator:#Escape action:#closeRequest.
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2524
        "/ remember this box for me.
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2525
        self objectAttributeAt:#currentModelessSearchBox put:searchBox.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2526
    ]
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2527
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2528
    "Modified: / 11-07-2006 / 11:18:38 / fm"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2529
    "Created: / 08-03-2012 / 14:02:59 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2530
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2531
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2532
replace:someText
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2533
    "replace the selection by someText. I am readonly, so this is a no-op here.
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2534
     Subclasses may redefine me."
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2535
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2536
    ^ self.
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2537
!
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2538
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2539
save
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2540
    "save contents into a file
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2541
     - ask user for filename using a fileSelectionBox."
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2542
3201
ce84e272c6bb code cleanup
Claus Gittinger <cg@exept.de>
parents: 3189
diff changeset
  2543
    saveAction value
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2544
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2545
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2546
saveAs:fileName
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2547
    "save the contents into a file named fileName.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2548
     On error return false otherwise return true"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2549
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2550
    ^ self saveAs:fileName doAppend:false
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2551
!
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2552
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2553
saveAs:aFilename doAppend:doAppend
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2554
    "save the contents into a file named fileName;
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2555
     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
  2556
     contents - otherwise, it overwrites any previous file contents.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2557
     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
  2558
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2559
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:true
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2560
!
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2561
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2562
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2563
    "save the contents into a file named fileName;
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2564
     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
  2565
     contents - otherwise, it overwrites any previous file contents.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2566
     On error return false otherwise return true"
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2567
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2568
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:nil
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2569
!
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2570
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2571
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:eolMode
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2572
    "save the contents into a file named fileName;
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2573
     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
  2574
     contents - otherwise, it overwrites any previous file contents.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2575
     eolMode is one of #cr, #nl or #crlf.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2576
     On error return false otherwise return true."
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2577
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2578
    |filename msg|
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2579
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2580
    filename := aFilename asFilename.
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2581
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2582
    self withWriteCursorDo:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2583
	|aStream|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2584
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2585
	(FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2586
	    msg := resources
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2587
			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
  2588
			with:filename name.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2589
	] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2590
	    [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2591
		doAppend ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2592
		    aStream := filename appendingWriteStream.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2593
		] ifFalse:[
5765
0040b98cc465 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5764
diff changeset
  2594
                    UserPreferences current generateBackupFileWhenSaving ifTrue:[
0040b98cc465 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5764
diff changeset
  2595
                        filename exists ifTrue:[
0040b98cc465 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5764
diff changeset
  2596
                            filename moveTo:(filename pathName,'.bak') asFilename
0040b98cc465 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5764
diff changeset
  2597
                        ].    
0040b98cc465 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5764
diff changeset
  2598
                    ].    
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2599
		    aStream := filename newReadWriteStream.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2600
		].
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2601
                aStream eolMode:eolMode.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2602
		self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2603
		aStream syncData; close.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2604
		contentsWasSaved := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2605
		defaultFileNameForFileDialog := filename.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2606
	    ] on:FileStream openErrorSignal do:[:ex|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2607
		msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2608
				with:filename name
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2609
				with:FileStream lastErrorString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2610
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2611
	].
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2612
    ].
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2613
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2614
    msg notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2615
	Dialog warn:msg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2616
	^ false
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2617
    ].
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2618
    ^ true
916
4201c9c2a4f0 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  2619
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2620
    "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
  2621
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2622
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2623
search
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2624
    "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
  2625
     - 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
  2626
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2627
    self openSearchBoxAndSearch
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2628
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2629
    "Modified: / 11-07-2006 / 11:18:38 / fm"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2630
    "Modified: / 08-03-2012 / 14:03:10 / cg"
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2631
!
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2632
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2633
search:patternArg ignoreCase:ign forward:fwd
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2634
    "search for a string without matching"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2635
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2636
    self search:patternArg ignoreCase:ign match: false forward:fwd
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2637
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2638
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2639
search:patternArg ignoreCase:ign match: match forward:fwd
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2640
    |pattern|
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2641
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2642
    pattern := patternArg string.
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2643
    pattern notEmpty ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2644
	self rememberSearchPattern:pattern.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2645
	"/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2646
	"/ LastSearchWasMatch := match.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2647
	fwd ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2648
	    lastSearchDirection := #backward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2649
	    self searchBwd:pattern ignoreCase:ign match: match.          "    backward search with match is not yet available  "
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2650
	] ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2651
	    lastSearchDirection := #forward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2652
	    self searchFwd:pattern ignoreCase:ign match: match.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2653
	]
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2654
    ]
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2655
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2656
    "Created: / 11-07-2006 / 11:18:04 / fm"
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  2657
    "Modified: / 23-03-2012 / 12:12:07 / cg"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2658
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2659
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2660
searchUsingSpec:aSearchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2661
    self rememberSearchPattern:(aSearchSpec pattern).
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2662
    "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2663
    "/ LastSearchWasMatch := match.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2664
    aSearchSpec forward ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2665
	lastSearchDirection := #backward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2666
	self searchBwdUsingSpec:aSearchSpec
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2667
    ] ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2668
	lastSearchDirection := #forward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2669
	self searchFwdUsingSpec:aSearchSpec
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2670
    ]
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2671
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2672
    "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
  2673
    "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
  2674
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2675
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2676
searchVariableVisible
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2677
    "search variable option in searchbox visible?
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2678
     (only true for codeview2's textview)"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2679
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2680
    ^ false
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2681
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2682
    "Created: / 08-03-2012 / 14:01:24 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2683
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2684
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2685
searchVariableWithSyntaxElement:syntaxElementForVariable forward:fwd
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2686
    "this only works for CodeView2::TextView, which supports syntaxElements.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2687
     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
  2688
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2689
    |el el2|
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2690
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2691
    lastSearchWasVariableSearch := true.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2692
    el := fwd
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2693
	ifTrue:[syntaxElementForVariable nextElement]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2694
	ifFalse:[syntaxElementForVariable previousElement].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2695
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2696
    el notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2697
	"bug workaround"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2698
	(el start = syntaxElementForVariable start) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2699
	    el2 := fwd
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2700
		ifTrue:[el nextElement]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2701
		ifFalse:[el previousElement].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2702
	    el2 notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2703
		el := el2
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2704
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2705
	].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2706
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2707
    el notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2708
	self selectFromCharacterPosition:el start to:el stop.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2709
	self makeLineVisible:(self lineOfCharacterPosition:el start).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2710
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2711
	self showNotFound
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2712
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2713
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2714
    "Created: / 08-03-2012 / 14:08:20 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2715
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2716
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2717
syntaxElementForSelectedVariable
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2718
    "for a better search; ignored here, but redefined in CodeView2"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2719
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2720
    ^ nil
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2721
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2722
    "Created: / 08-03-2012 / 14:20:27 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2723
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2724
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2725
syntaxElementForVariableUnderCursor
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2726
    "for a better search; ignored here, but redefined in CodeView2"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2727
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2728
    ^ nil
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2729
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2730
    "Created: / 08-03-2012 / 12:45:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2731
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2732
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2733
!TextView methodsFor:'native widget support'!
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2734
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2735
nativeWindowType
5128
787b617a99e5 Merged 52e9f87d45c8 and fcd696f9f401 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5085 5120
diff changeset
  2736
    "return a symbol describing my native window type
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2737
     (may be used internally by the device as a native window creation hint,
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2738
      if the device supports native windows)"
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2739
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2740
    ^ #TextView
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2741
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2742
    "Created: 2.5.1997 / 14:41:00 / cg"
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2743
! !
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2744
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2745
!TextView methodsFor:'private'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2746
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2747
currentSelectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2748
    ^  selectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2749
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2750
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2751
currentSelectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2752
    ^ selectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2753
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2754
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2755
fileOutContentsOn:aStream
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2756
    "save contents on a stream, replacing leading spaces by tab-characters."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2757
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2758
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2759
	fileOutContentsOn:aStream
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2760
	compressTabs:true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2761
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2762
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2763
fileOutContentsOn:aStream compressTabs:compressTabs
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2764
    "save contents on a stream. If compressTabs is true,
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2765
     leading spaces will be replaced by tab-characters in the output."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2766
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2767
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2768
	fileOutContentsOn:aStream
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2769
	compressTabs:compressTabs
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2770
	encoding:nil
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2771
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2772
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2773
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
  2774
    "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
  2775
     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
  2776
2877
cdaea8ccd364 encoding
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  2777
    |startNr nLines string encoder|
cdaea8ccd364 encoding
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  2778
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2779
    self removeTrailingWhitespace.
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2780
5658
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  2781
    "/ This is now obsolete, as we are always using unicode internally.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  2782
    "/ so the following line should be changed to encoderToEncodeFrom:unicode to:xxx.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2783
    encoder := CharacterEncoder encoderToEncodeFrom:gc characterEncoding into:encodingSymOrNil.
4455
febe97112d50 changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  2784
    encoder isNullEncoder ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2785
	(list contains:[:lineOrNil|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2786
			    |s|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2787
			    lineOrNil notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2788
			    and:[(s := lineOrNil string string) isWideString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2789
			    and:[s asSingleByteStringIfPossible isWideString]]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2790
		       ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2791
	) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2792
	    (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
  2793
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2794
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2795
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2796
	encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8
4455
febe97112d50 changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  2797
    ].
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  2798
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2799
    aStream isFileStream ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2800
	"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
  2801
	 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
  2802
	 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
  2803
	 limiting temporary string creation to about 50-80k.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2804
	"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2805
	startNr := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2806
	nLines := list size.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2807
        (aStream eolMode notNil
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2808
        and:[aStream eolMode ~= #nl]) ifTrue:[
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2809
            "/ must do it lineWise ...
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2810
            list do:[:line |
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2811
                line notNil ifTrue:[
5326
ef27d6e1ebcd class: TextView
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2812
                    encoder encodeString:line withTabs on:aStream
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2813
                ].
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2814
                aStream cr
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2815
            ].
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2816
        ] ifFalse:[
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2817
            [startNr <= nLines] whileTrue:[
5128
787b617a99e5 Merged 52e9f87d45c8 and fcd696f9f401 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5085 5120
diff changeset
  2818
                string := list
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2819
                            asStringWithCRsFrom:startNr
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2820
                            to:((startNr + 1000) min:nLines)
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2821
                            compressTabs:compressTabs.
5326
ef27d6e1ebcd class: TextView
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2822
                encoder encodeString:string string on:aStream.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2823
                startNr := startNr + 1000 + 1.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2824
            ].
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2825
        ].
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2826
    ] ifFalse:[
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2827
        list do:[:aLine |
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2828
            aLine notNil ifTrue:[
5326
ef27d6e1ebcd class: TextView
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2829
                encoder encodeString:aLine on:aStream.
ef27d6e1ebcd class: TextView
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2830
            ].
ef27d6e1ebcd class: TextView
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2831
            aStream cr.
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2832
        ]
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2833
    ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2834
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2835
    "Modified: 8.6.1996 / 11:50:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2836
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2837
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2838
getFontParameters
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2839
    "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
  2840
     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
  2841
     line separation. This is required, to allow for proper handling of
4779
9f7633fc5583 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4767
diff changeset
  2842
     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
  2843
5444
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2844
    |italicFont boldFont currentDeviceFont |
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2845
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2846
    currentDeviceFont := gc createFontOnDevice.
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2847
    "/ do we really need this info now?
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2848
    "/ on unix, it seems to work with the next two lines commented;
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2849
    "/ should probably check on windows too
5444
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2850
    italicFont := currentDeviceFont asItalic onDevice:self device.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2851
    boldFont := currentDeviceFont asBold onDevice:self device.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2852
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2853
    fontHeight := currentDeviceFont height.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2854
    fontAscent := currentDeviceFont ascent. 
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2855
    fontWidth := currentDeviceFont width.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5417 5443
diff changeset
  2856
    fontIsFixedWidth := currentDeviceFont isFixedWidth.
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2857
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2858
    "/ fA := font maxAscent. 
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2859
    italicFont notNil ifTrue:[ 
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2860
        fontHeight := fontHeight max:(italicFont height).
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2861
        fontAscent := fontAscent max:(italicFont ascent).
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2862
        fontIsFixedWidth := fontIsFixedWidth and:[ italicFont isFixedWidth ]
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2863
    ]. 
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2864
    boldFont notNil ifTrue:[ 
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2865
        fontHeight := fontHeight max:(boldFont height).
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2866
        fontAscent := fontAscent max:(boldFont ascent).
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2867
        fontIsFixedWidth := fontIsFixedWidth and:[ boldFont isFixedWidth ]
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2868
    ]. 
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2869
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2870
    includesNonStrings == true ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2871
	"/ for now, we do not support variable height entries ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2872
	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
  2873
    ].
4579
3a5a72358a0a class: TextView
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
  2874
    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
  2875
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2876
    "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
  2877
    "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
  2878
!
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2879
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2880
highlightLineSpacing
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2881
    "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
  2882
     false if it remains white.
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2883
     false for selection in list views; true for edit/text views"
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2884
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2885
    ^ true
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2886
!
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2887
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2888
isClosingParenthesis:ch
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2889
    ((parenthesisSpecification at:#close) includes:ch) ifTrue:[^ true].
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2890
    ^ ')]}' includes:ch
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2891
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2892
    "Modified: / 12-02-2012 / 08:37:01 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2893
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2894
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2895
isOpeningParenthesis:ch
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2896
    ((parenthesisSpecification at:#open) includes:ch) ifTrue:[^ true].
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2897
    ^ '([{' includes:ch
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2898
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2899
    "Modified: / 12-02-2012 / 08:37:11 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2900
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2901
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2902
rememberSearchPattern:pattern
2691
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  2903
    |nRemembered patternString|
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  2904
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2905
    self clearSearchAction.
2813
ec8e83691849 forget searchAction, when a new pattern-search is done
Claus Gittinger <cg@exept.de>
parents: 2811
diff changeset
  2906
2691
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  2907
    patternString := pattern string.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2908
3270
e3ed37e15f9d oops - last-searchpatterns handling removed the wrong one.
Claus Gittinger <cg@exept.de>
parents: 3258
diff changeset
  2909
    nRemembered := NumRememberedSearchPatterns ? 20.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2910
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2911
    LastSearchPatterns isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2912
	LastSearchPatterns := OrderedCollection new.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2913
    ].
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2914
    "/ move to top or addFirst
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2915
    (LastSearchPatterns includes:patternString) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2916
	LastSearchPatterns remove:patternString.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2917
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2918
	LastSearchPatterns size > nRemembered ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2919
	    LastSearchPatterns removeLast
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2920
	]
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2921
    ].
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2922
    LastSearchPatterns addFirst:patternString.
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2923
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2924
    "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
  2925
!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2926
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2927
removeTrailingWhitespace
3001
d9877eeb59f5 *** empty log message ***
ca
parents: 2992
diff changeset
  2928
    list isNil ifTrue:[^self].
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2929
    list keysAndValuesDo:[:lineNR :line |
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2930
	|l|
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2931
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2932
	line notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2933
	    l := line withoutTrailingSeparators.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2934
	    list at:lineNR put:l.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2935
	]
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2936
    ].
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2937
!
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2938
4009
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2939
resetVariablesBeforeNewSearch
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2940
    "clear the autosearch action, when the first pattern is searched for"
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2941
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2942
    searchAction := nil.
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2943
!
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2944
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2945
scrollSelectDown
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2946
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2947
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2948
    |prevEndLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2949
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2950
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2951
    selectionEndLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2952
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2953
    self scrollDown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2954
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2955
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2956
    prevEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2957
    selectionEndLine := firstLineShown + nFullLinesShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2958
    selectionEndCol := 0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2959
    prevEndLine to:selectionEndLine do:[:lineNr |
5235
888c50995301 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5120
diff changeset
  2960
        self redrawLine:lineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2961
    ].
5235
888c50995301 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5120
diff changeset
  2962
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  2963
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2964
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2965
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2966
scrollSelectLeft
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2967
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2968
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2969
    |prevStartLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2970
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2971
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2972
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2973
    selectionStartCol isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2974
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2975
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2976
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2977
    selectionStartCol := selectionStartCol - 1 max:1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2978
    self scrollLeft.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2979
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2980
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  2981
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2982
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2983
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2984
scrollSelectRight
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2985
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2986
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2987
    |prevEndCol firstVisibleCol endLine|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2988
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2989
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2990
    selectionEndCol isNil ifTrue:[^ self].
4169
11d3b7a3e713 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4160
diff changeset
  2991
    selectionEndLine isNil ifTrue:[^ self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2992
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2993
    prevEndCol := selectionEndCol.
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2994
    selectionEndCol := (selectionEndCol + 1) min:(self listAt:selectionEndLine) size.
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2995
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2996
    endLine := self listLineToVisibleLine:selectionEndLine.
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2997
    endLine notNil ifTrue:[
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2998
        firstVisibleCol := self colOfX:1 inVisibleLine:endLine.
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2999
        selectionEndCol < firstVisibleCol ifTrue:[
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3000
            "/ scrolling faster than selection advances...
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3001
            selectionEndCol := firstVisibleCol
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3002
        ].
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3003
    ].
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3004
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3005
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3006
    self scrollRight.
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3007
    "/ self repairDamage.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3008
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3009
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3010
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3011
    "Modified: / 05-08-2010 / 21:25:56 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3012
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3013
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3014
scrollSelectUp
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3015
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3016
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3017
    |prevStartLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3018
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3019
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3020
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3021
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3022
    self scrollUp.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3023
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3024
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3025
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3026
    selectionStartLine := firstLineShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3027
    selectionStartCol := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3028
    selectionStartLine to:prevStartLine do:[:lineNr |
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3029
        self redrawLine:lineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3030
    ].
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3031
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  3032
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3033
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3034
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3035
stopScrollSelect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3036
    "stop auto scroll; deinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3037
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3038
    autoScrollBlock notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3039
	Processor removeTimedBlock:autoScrollBlock.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3040
	self compressMotionEvents:true.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3041
	autoScrollBlock := nil.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3042
	autoScrollDeltaT := nil
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3043
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3044
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3045
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3046
textChanged
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3047
    self isNativeWidget ifTrue:[
5128
787b617a99e5 Merged 52e9f87d45c8 and fcd696f9f401 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5085 5120
diff changeset
  3048
        gc drawableId notNil ifTrue:[
787b617a99e5 Merged 52e9f87d45c8 and fcd696f9f401 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5085 5120
diff changeset
  3049
            gc device changeText:self contents in:gc drawableId
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3050
        ]
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3051
    ].
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3052
    super textChanged
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3053
!
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3054
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3055
widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3056
    "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
  3057
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3058
    selectionStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3059
	"/ if there is a selection which covers multiple lines,
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3060
	"/ we have to scroll the whole width (to include the selection-rectangle)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3061
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3062
	(lastLine < selectionStartLine) ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3063
	    (firstLine > selectionEndLine) ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3064
		^ width
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3065
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3066
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3067
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3068
    ^ super widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3069
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3070
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3071
!TextView methodsFor:'queries'!
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3072
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3073
hasSearchActionSelection
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3074
    "Here we fake the use of typeOfSelection which is really in EditTextView"
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3075
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3076
    ^ false
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3077
!
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3078
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3079
specClass
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  3080
    "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
  3081
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3082
    self class == TextView ifTrue:[^ TextEditorSpec].
1046
10da5b6bd390 specClass query
ca
parents: 1028
diff changeset
  3083
    ^ super specClass
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3084
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  3085
    "Modified: / 31.10.1997 / 19:48:35 / cg"
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3086
! !
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3087
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3088
!TextView methodsFor:'redrawing'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3089
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3090
clearMarginOfVisibleLine:visLine with:color
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3091
    "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
  3092
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3093
    (leftMargin ~~ 0) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3094
	viewOrigin x <= margin ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3095
	    self paint:color.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3096
	    self fillRectangleX:margin-viewOrigin x
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3097
			      y:(self yOfVisibleLine:visLine)- (lineSpacing//2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3098
			  width:leftMargin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3099
			 height:fontHeight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3100
	]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3101
    ]
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3102
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3103
    "Created: 6.3.1996 / 14:22:55 / cg"
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3104
!
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3105
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3106
drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3107
    startVisLineNr to:endVisLineNr do:[:visLine |
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3108
	self drawVisibleLineSelected:visLine
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3109
    ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3110
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3111
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3112
drawVisibleLineSelected:visLineNr
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3113
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3114
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3115
	inVisible:visLineNr
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3116
	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
  3117
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3118
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3119
drawVisibleLineSelected:visLineNr col:col
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3120
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3121
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3122
	inVisible:visLineNr
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3123
	col:col
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3124
	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
  3125
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3126
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3127
drawVisibleLineSelected:visLineNr from:selectionStartCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3128
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3129
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3130
	inVisible:visLineNr
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3131
	from:selectionStartCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3132
	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
  3133
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3134
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3135
drawVisibleLineSelected:visLineNr from:startCol to:endCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3136
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3137
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3138
	inVisible:visLineNr
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3139
	from:startCol to:endCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3140
	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
  3141
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3142
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3143
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3144
    "redraw a visible line range"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3145
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3146
    |startLine endLine specialCare end selVisStart line1 line2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3147
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3148
    shown ifFalse:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3149
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3150
    end := endVisLineNr.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3151
    (end > nLinesShown) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3152
	end := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3153
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3154
2740
892dfb6b0da1 kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  3155
    selectionEndLine isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3156
	selectionStartLine := nil
2740
892dfb6b0da1 kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  3157
    ].
2735
5ba2010aefa4 *** empty log message ***
penk
parents: 2730
diff changeset
  3158
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3159
    selectionStartLine isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3160
	specialCare := false
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3161
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3162
	startLine := self visibleLineToAbsoluteLine:startVisLineNr.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3163
	(startLine > selectionEndLine) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3164
	    specialCare := false
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3165
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3166
	    endLine := self visibleLineToAbsoluteLine:end.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3167
	    (endLine < selectionStartLine) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3168
		specialCare := false
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3169
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3170
		specialCare := true
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3171
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3172
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3173
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3174
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3175
    "easy: nothing is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3176
    specialCare ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3177
	super redrawFromVisibleLine:startVisLineNr to:end.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3178
	^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3179
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3180
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3181
    "easy: all is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3182
    ((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3183
	self drawSelectedFromVisibleLine:startVisLineNr to:end.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3184
	^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3185
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3186
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3187
    (selectionStartLine >= firstLineShown) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3188
	"draw unselected top part"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3189
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3190
	selVisStart := self listLineToVisibleLine:selectionStartLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3191
	super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1).
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3192
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3193
	"and first partial selected line"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3194
	self redrawVisibleLine:selVisStart.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3195
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3196
	"rest starts after this one"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3197
	line1 := selVisStart + 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3198
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3199
	line1 := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3200
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3201
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3202
    (line1 > end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3203
    (line1 < startVisLineNr) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3204
	line1 := startVisLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3205
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3206
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3207
    "draw middle part of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3208
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3209
    (selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3210
	line2 := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3211
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3212
	line2 := (self listLineToVisibleLine:selectionEndLine) - 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3213
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3214
    (line2 > end) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3215
	line2 := end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3216
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3217
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3218
    self drawSelectedFromVisibleLine:line1 to:line2.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3219
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3220
    (line2 >= end) ifTrue:[^ self].
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
    "last line of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3223
    self redrawVisibleLine:(line2 + 1).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3224
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3225
    ((line2 + 2) <= end) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3226
	super redrawFromVisibleLine:(line2 + 2) to:end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3227
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3228
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3229
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3230
redrawVisibleLine:visLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3231
    "redraw visible line lineNr"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3232
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3233
    |line|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3234
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3235
    (selectionStartLine notNil and:[selectionEndLine notNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3236
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3237
	line := self visibleLineToAbsoluteLine:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3238
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3239
	    (line == selectionStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3240
		(line == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3241
		    "it's part-of-single-line selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3242
		    self clearMarginOfVisibleLine:visLineNr with:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3243
		    (selectionStartCol > 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3244
			super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3245
		    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3246
		    self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3247
		    super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3248
		    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3249
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3250
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3251
		"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
  3252
		(selectionStartCol ~~ 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3253
		    self clearMarginOfVisibleLine:visLineNr with:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3254
		    super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3255
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3256
		    viewOrigin x == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3257
			self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3258
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3259
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3260
		self drawVisibleLineSelected:visLineNr from:selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3261
		^ self
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3264
	    (line == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3265
		"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
  3266
		(selectionEndCol == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3267
		    ^ super redrawVisibleLine:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3268
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3269
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3270
		self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3271
		self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3272
		super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3273
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3274
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3275
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3276
	    "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
  3277
	    self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3278
	    self drawVisibleLineSelected:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3279
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3280
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3281
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3282
    super redrawVisibleLine:visLineNr
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3283
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3284
    "Modified: 6.3.1996 / 14:22:19 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3285
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3286
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3287
redrawVisibleLine:visLine col:col
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3288
    "redraw single character at col in visible line lineNr."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3289
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3290
    |line|
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3291
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3292
    "/
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3293
    "/ care for selection
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3294
    "/
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3295
    (selectionStartLine notNil and:[selectionEndLine notNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3296
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3297
	line := self visibleLineToAbsoluteLine:visLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3298
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3299
	    ((line == selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3300
	    and: [col < selectionStartCol]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3301
		((line == selectionEndLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3302
		and: [col > selectionEndCol]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3303
		    "its in the selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3304
		    self drawVisibleLineSelected:visLine col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3305
		    ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3306
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3307
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3308
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3309
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3310
    self drawVisibleLine:visLine col:col with:fgColor and:bgColor
1496
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3311
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3312
    "Modified: / 22.4.1998 / 08:53:05 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3313
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3314
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3315
redrawVisibleLine:visLine from:startCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3316
    "redraw visible line lineNr from startCol to end of line"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3317
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3318
    |col line|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3319
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3320
    col := startCol.
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3321
    col == 0 ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3322
	col := 1.
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3323
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3324
2778
223915a2d6a4 kludge workaround selectionEndLine is sometimes nil
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  3325
    (selectionStartLine notNil and:[selectionEndLine notNil]) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3326
	line := self visibleLineToAbsoluteLine:visLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3327
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3328
	    ((line == selectionStartLine)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3329
	     or:[line == selectionEndLine]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3330
		"since I'm lazy, redraw full line"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3331
		self redrawVisibleLine:visLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3332
		^ self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3333
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3334
	    "the line is fully within the selection"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3335
	    self drawVisibleLineSelected:visLine from:col.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3336
	    ^ self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3337
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3338
    ].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3339
    super redrawVisibleLine:visLine from:col
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3340
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3341
    "Modified: 6.3.1996 / 14:19:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3342
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3343
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3344
redrawVisibleLine:visLine from:startCol to:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3345
    "redraw visible line lineNr from startCol to endCol"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3346
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3347
    |line allOut allIn leftCol rightCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3348
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3349
    line := self visibleLineToAbsoluteLine:visLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3350
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3351
    allIn := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3352
    allOut := false.
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3353
    (selectionStartLine isNil or:[selectionEndLine isNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3354
    or:[selectionStartCol isNil or:[selectionEndCol isNil]]]) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3355
	allOut := true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3356
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3357
	(line between:selectionStartLine and:selectionEndLine) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3358
	    allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3359
	] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3360
	    (selectionStartLine == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3361
		((endCol < selectionStartCol)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3362
		or:[startCol > selectionEndCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3363
		    allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3364
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3365
		    ((startCol >= selectionStartCol)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3366
		    and:[endCol <= selectionEndCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3367
			allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3368
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3369
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3370
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3371
		(line == selectionStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3372
		    (endCol < selectionStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3373
			allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3374
		    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3375
			(startCol >= selectionStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3376
			    allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3377
			]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3378
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3379
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3380
		    (line == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3381
			(startCol > selectionEndCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3382
			    allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3383
			] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3384
			    (endCol <= selectionEndCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3385
				allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3386
			    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3387
			]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3388
		    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3389
			allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3390
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3391
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3392
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3393
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3394
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3395
    allOut ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3396
	super redrawVisibleLine:visLine from:startCol to:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3397
	^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3398
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3399
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3400
    allIn ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3401
	self drawVisibleLineSelected:visLine from:startCol to:endCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3402
    ] ifFalse:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3403
	"redraw part before selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3404
	((line == selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3405
	 and:[startCol <= selectionStartCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3406
	    super redrawVisibleLine:visLine from:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3407
					      to:(selectionStartCol - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3408
	    leftCol := selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3409
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3410
	    leftCol := startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3411
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3412
	"redraw selected part"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3413
	(selectionEndLine > line) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3414
	    rightCol := endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3415
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3416
	    rightCol := selectionEndCol min:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3417
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3418
	self drawVisibleLineSelected:visLine from:leftCol to:rightCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3419
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3420
	"redraw part after selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3421
	(rightCol < endCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3422
	    super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3423
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3424
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3425
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3426
    "special care for first and last line of selection:
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3427
     must handle margin also"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3428
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3429
    ((line == selectionEndLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3430
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3431
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3432
    ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3433
	self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3434
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3435
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3436
    ((line == selectionStartLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3437
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3438
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3439
    ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3440
	self clearMarginOfVisibleLine:visLine with:bgColor.
4602
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3441
    ].
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3442
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3443
    ((line > selectionStartLine)
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3444
    and:[(startCol == 1)
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3445
    and:[selectionStartLine < selectionEndLine
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3446
    and:[line < selectionEndLine]]])
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3447
    ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3448
	self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3449
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3450
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3451
    "Modified: 6.3.1996 / 14:23:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3452
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3453
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3454
!TextView methodsFor:'searching'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3455
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3456
clearSearchAction
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3457
    searchAction := nil.
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3458
!
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3459
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3460
scanFor:aCharacter fromLine:startLine col:startCol forward:forward
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3461
		     ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3462
		  ifNotFound:notFoundBlock
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3463
    "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
  3464
     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
  3465
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3466
    |lineString
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3467
     line   "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3468
     col    "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3469
     delta  "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3470
     endCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3471
     cc
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3472
     maxLine "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3473
      |
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3474
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3475
    col := startCol.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3476
    line := startLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3477
    forward ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3478
	delta := 1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3479
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3480
	delta := -1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3481
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3482
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3483
    lineString := list at:line.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3484
    maxLine := list size.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3485
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3486
    col := col + delta.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3487
    [true] whileTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3488
	lineString notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3489
	    forward ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3490
		endCol := lineString size.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3491
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3492
		endCol := 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3493
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3494
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3495
	    col to:endCol by:delta do:[:rCol |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3496
		cc := lineString at:rCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3497
		cc == aCharacter ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3498
		    ^ foundBlock value:line value:rCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3499
		]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3500
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3501
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3502
	line := line + delta.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3503
	(line < 1 or:[line > maxLine]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3504
	    ^ notFoundBlock value
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3505
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3506
	lineString := list at:line.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3507
	forward ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3508
	    col := 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3509
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3510
	    col := lineString size
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3511
	]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3512
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3513
    "not reached"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3514
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3515
    "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
  3516
    "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
  3517
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3518
3802
sr
parents: 3792
diff changeset
  3519
searchAction
sr
parents: 3792
diff changeset
  3520
    ^ searchAction
sr
parents: 3792
diff changeset
  3521
!
sr
parents: 3792
diff changeset
  3522
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3523
searchAction:aSearcherOrSearchBlock
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3524
    searchAction := aSearcherOrSearchBlock
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3525
!
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3526
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3527
searchAgainInSameDirection
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3528
    "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
  3529
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3530
    |ign match|
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3531
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  3532
    searchBarActionBlock notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3533
	searchBarActionBlock value:#forward value:self.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3534
	^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3535
    ].
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3536
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3537
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3538
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3539
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3540
    self setSearchPatternWithMatchEscapes: match.
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3541
    lastSearchPattern notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3542
	lastSearchDirection == #backward ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3543
	    self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3544
		searchBwd:lastSearchPattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3545
		ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3546
		match: match
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3547
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3548
	    self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3549
		searchFwd:lastSearchPattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3550
		ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3551
		match: match
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3552
	]
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3553
    ]
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3554
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3555
    "Created: / 03-05-1999 / 15:02:16 / cg"
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3556
    "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
  3557
!
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3558
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3559
searchBwd
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3560
    "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
  3561
     If found, position cursor"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3562
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3563
    |ign selectedVariable|
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  3564
2811
3a7aed97fd76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  3565
    searchAction notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3566
	"/autosearch is cleared whenever there is search with user selection
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3567
	(self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
4178
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3568
    ].
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3569
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3570
    searchAction notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3571
	"/confusing: this is for autosearch of variables (browse variable uses, for example)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3572
	self searchUsingSearchAction:#backward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3573
	^ self.
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3574
    ].
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  3575
    searchBarActionBlock notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3576
	searchBarActionBlock value:#backward value:self.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3577
	^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3578
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3579
    lastSearchWasVariableSearch ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3580
	selectedVariable := self syntaxElementForSelectedVariable.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3581
	selectedVariable notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3582
	    self searchVariableWithSyntaxElement:selectedVariable forward:false.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3583
	    ^ self.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3584
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3585
	lastSearchWasVariableSearch := false.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3586
    ].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3587
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3588
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  3589
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3590
    self setSearchPatternWithMatchEscapes: false.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3591
    lastSearchPattern isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3592
	LastSearchPatterns size > 0 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3593
	    lastSearchPattern := LastSearchPatterns first
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3594
	]
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3595
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3596
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3597
    lastSearchPattern notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3598
	lastSearchDirection := #backward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3599
	self rememberSearchPattern:lastSearchPattern.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3600
	self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3601
	    searchBwd:lastSearchPattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3602
	    ignoreCase:ign
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3603
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3604
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3605
    "Modified: / 08-03-2012 / 14:26:25 / 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
searchBwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3609
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3610
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3611
    self searchBwd:pattern ifAbsent:[self showNotFound].
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3612
"/    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3613
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3614
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3615
    "Modified: / 21-09-2006 / 16:48:29 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3616
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3617
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3618
searchBwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3619
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3620
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3621
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3622
	searchBwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3623
					pattern:pattern)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3624
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3625
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3626
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3627
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3628
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3629
searchBwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3630
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3631
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3632
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3633
	searchBwd:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3634
	ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3635
	ifAbsent:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3636
		    self sensor compressKeyPressEventsWithKey:#FindPrev.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3637
		    self showNotFound
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3638
		 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3639
    "/ lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3640
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3641
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3642
    "Created: / 13-09-1997 / 06:18:00 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3643
    "Modified: / 23-03-2012 / 12:10:25 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3644
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3645
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3646
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3647
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3648
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3649
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3650
	searchBwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3651
					pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3652
					ignoreCase:ign)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3653
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3654
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3655
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3656
    "Created: 13.9.1997 / 06:18:41 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3657
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3658
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3659
searchBwd:pattern ignoreCase:ign match: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3660
    "do a backward search.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3661
    match pattern functionality is not yet available for backward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3662
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3663
    "/ lastSearchWasMatch := match.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3664
    self searchBwd:pattern ignoreCase:ign.
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3665
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3666
    "Modified: / 23-03-2012 / 12:12:44 / cg"
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3667
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3668
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3669
searchBwdUsingSpec:searchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3670
    "do a backward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3671
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3672
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3673
	searchBwdUsingSpec:searchSpec
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3674
	ifAbsent:[self showNotFound].
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3675
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3676
"/    lastSearchIgnoredCase := false.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3677
    lastSearchPattern := searchSpec pattern string
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3678
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3679
    "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
  3680
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3681
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3682
searchBwdUsingSpec:searchSpec ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3683
    "do a backward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3684
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3685
    |pos startLine startCol|
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3686
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3687
    pos :=  self startPositionForSearchBackward.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3688
    startLine := pos y.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3689
    startCol := pos x.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3690
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3691
    self
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  3692
        searchBackwardUsingSpec:searchSpec
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  3693
        startingAtLine:startLine col:startCol
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  3694
        ifFound:[:line :col :endColOrNil| 
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  3695
            self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  3696
        ]
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  3697
        ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3698
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3699
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3700
searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3701
    "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
  3702
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3703
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3704
	searchForMatchingParenthesisFromLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3705
	ifFound:[:line :col |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3706
		  self selectFromLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3707
			       toLine:line col:col]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3708
	ifNotFound:[self showNotFound]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3709
	onError:[self beep]
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3710
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3711
    "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
  3712
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3713
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3714
searchForMatchingParenthesisFromLine:startLine col:startCol
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3715
		     ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3716
		  ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3717
		     onError:failBlock
2553
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
    "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
  3720
     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
  3721
     backwards if its a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3722
     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
  3723
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3724
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3725
    ^ self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3726
	searchForMatchingParenthesisFromLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3727
	ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3728
	ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3729
	onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3730
	ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' )
3478
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3731
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3732
    "Modified: / 12-04-2007 / 11:24:24 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3733
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3734
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3735
searchForMatchingParenthesisFromLine:startLine col:startCol
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3736
		     ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3737
		  ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3738
		     onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3739
		    ignoring:ignoreSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3740
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3741
    "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
  3742
     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
  3743
     backwards if its a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3744
     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
  3745
     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
  3746
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3747
    ^ self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3748
	searchForMatchingParenthesisFromLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3749
	ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3750
	ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3751
	onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3752
	openingCharacters: (parenthesisSpecification at:#open)  "/ #( $( $[ ${ "$> $<")
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3753
	closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<")
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3754
	ignoredCharacters: ignoreSet
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3755
	specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3756
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3757
"/    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3758
"/     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3759
"/     ignoring
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3760
"/     line   "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3761
"/     col    "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3762
"/     delta  "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3763
"/     endCol "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3764
"/     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3765
"/     cc prevCC nextCC incSet decSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3766
"/     nesting "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3767
"/     maxLine "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3768
"/     ign skip anySet|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3769
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3770
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
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
"/    parChar := self characterAtLine:startLine col:startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3773
"/    i := charSet indexOf:parChar.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3774
"/    i == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3775
"/        ^ failBlock value   "not a parenthesis"
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
"/    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
  3778
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3779
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3780
"/    col := startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3781
"/    line := startLine.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3782
"/    direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3783
"/        delta := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3784
"/        incSet := #( $( $[ ${ "$<" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3785
"/        decSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3786
"/    ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3787
"/        delta := -1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3788
"/        incSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3789
"/        decSet := #( $( $[ ${ "$<" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3790
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3791
"/    anySet := Set new.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3792
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3793
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3794
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3795
"/    nesting := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3796
"/    ignoring := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3797
"/    lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3798
"/    maxLine := list size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3799
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3800
"/    col := col + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3801
"/    [nesting ~~ 0] whileTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3802
"/        (lineString notNil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3803
"/        and:[lineString includesAny:anySet]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3804
"/            direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3805
"/                endCol := lineString size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3806
"/            ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3807
"/                endCol := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3808
"/            ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3809
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3810
"/            col to:endCol by:delta do:[:rCol |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3811
"/                runCol := rCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3812
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3813
"/                cc := lineString at:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3814
"/                runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3815
"/                    nextCC := lineString at:runCol+1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3816
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3817
"/                    nextCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3818
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3819
"/                runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3820
"/                    prevCC := lineString at:runCol-1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3821
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3822
"/                    prevCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3823
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3824
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3825
"/                ign := skip := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3826
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3827
"/                "/ check for comments.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3828
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3829
"/                ((cc == $" and:[nextCC == $/])
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3830
"/                or:[prevCC == $$ ]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3831
"/                    "/ do nothing
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3832
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3833
"/                    skip := true.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3834
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3835
"/                    ignoreSet do:[:ignore |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3836
"/                        ignore == cc ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3837
"/                            ign := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3838
"/                        ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3839
"/                            ignore isString ifTrue:[
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3840
"/                                cc == (ignore at:2) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3841
"/                                    runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3842
"/                                        (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
  3843
"/                                            skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3844
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3845
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3846
"/                                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3847
"/                                    cc == (ignore at:1) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3848
"/                                        runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3849
"/                                            (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
  3850
"/                                                skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3851
"/                                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3852
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3853
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3854
"/                                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3855
"/                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3856
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3857
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3858
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3859
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3860
"/                ign ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3861
"/                    ignoring := ignoring not
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3862
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3863
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3864
"/                ignoring ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3865
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3866
"/                        (incSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3867
"/                            nesting := nesting + 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3868
"/                        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3869
"/                            (decSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3870
"/                                nesting := nesting - 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3871
"/                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3872
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3873
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3874
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3875
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3876
"/                nesting == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3877
"/                    "check if legal"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3878
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3879
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3880
"/                        cc == closingChar ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3881
"/                            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3882
"/                        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3883
"/                        ^ foundBlock value:line value:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3884
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3885
"/                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3886
"/            ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3887
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3888
"/        line := line + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3889
"/        (line < 1 or:[line > maxLine]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3890
"/            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3891
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3892
"/        lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3893
"/        direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3894
"/            col := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3895
"/        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3896
"/            col := lineString size
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3897
"/        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3898
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3899
"/    ^ notFoundBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3900
3478
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3901
    "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
  3902
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3903
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3904
searchForMatchingParenthesisFromLine:startLine col:startCol
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3905
		     ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3906
		  ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3907
		     onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3908
	   openingCharacters:openingCharacters
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3909
	   closingCharacters:closingCharacters
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3910
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3911
    "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
  3912
     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
  3913
     backwards if its a closing parenthesis.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3914
     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
  3915
     If there is a nesting error, evaluate failBlock."
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
    ^ self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3918
	searchForMatchingParenthesisFromLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3919
	ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3920
	ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3921
	onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3922
	openingCharacters: openingCharacters
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3923
	closingCharacters: closingCharacters
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3924
	ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#())
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3925
	specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3926
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3927
"/    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3928
"/     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3929
"/     ignoring
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3930
"/     line   "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3931
"/     col    "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3932
"/     delta  "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3933
"/     endCol "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3934
"/     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3935
"/     cc prevCC nextCC incSet decSet
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3936
"/     nesting "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3937
"/     maxLine "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3938
"/     ign skip anySet|
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3939
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3940
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
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
"/    parChar := self characterAtLine:startLine col:startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3943
"/    i := charSet indexOf:parChar.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3944
"/    i == 0 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3945
"/        ^ failBlock value   "not a parenthesis"
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
"/    direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3948
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3949
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3950
"/    col := startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3951
"/    line := startLine.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3952
"/    direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3953
"/        delta := 1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3954
"/        incSet := #( $( $[ ${ "$<" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3955
"/        decSet := #( $) $] $} "$>" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3956
"/    ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3957
"/        delta := -1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3958
"/        incSet := #( $) $] $} "$>" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3959
"/        decSet := #( $( $[ ${ "$<" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3960
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3961
"/    anySet := Set new.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3962
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3963
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3964
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3965
"/    nesting := 1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3966
"/    ignoring := false.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3967
"/    lineString := list at:line.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3968
"/    maxLine := list size.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3969
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3970
"/    col := col + delta.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3971
"/    [nesting ~~ 0] whileTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3972
"/        (lineString notNil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3973
"/        and:[lineString includesAny:anySet]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3974
"/            direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3975
"/                endCol := lineString size.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3976
"/            ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3977
"/                endCol := 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3978
"/            ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3979
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3980
"/            col to:endCol by:delta do:[:rCol |
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3981
"/                runCol := rCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3982
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3983
"/                cc := lineString at:runCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3984
"/                runCol < lineString size ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3985
"/                    nextCC := lineString at:runCol+1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3986
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3987
"/                    nextCC := nil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3988
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3989
"/                runCol > 1 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3990
"/                    prevCC := lineString at:runCol-1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3991
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3992
"/                    prevCC := nil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3993
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3994
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3995
"/                ign := skip := false.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3996
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3997
"/                "/ check for comments.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3998
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3999
"/                ((cc == $" and:[nextCC == $/])
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4000
"/                or:[prevCC == $$ ]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4001
"/                    "/ do nothing
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4002
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4003
"/                    skip := true.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4004
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4005
"/                    ignoreSet do:[:ignore |
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4006
"/                        ignore == cc ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4007
"/                            ign := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4008
"/                        ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4009
"/                            ignore isString ifTrue:[
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4010
"/                                cc == (ignore at:2) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4011
"/                                    runCol > 1 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4012
"/                                        (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4013
"/                                            skip := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4014
"/                                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4015
"/                                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4016
"/                                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4017
"/                                    cc == (ignore at:1) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4018
"/                                        runCol < lineString size ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4019
"/                                            (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4020
"/                                                skip := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4021
"/                                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4022
"/                                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4023
"/                                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4024
"/                                ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4025
"/                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4026
"/                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4027
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4028
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4029
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4030
"/                ign ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4031
"/                    ignoring := ignoring not
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4032
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4033
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4034
"/                ignoring ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4035
"/                    skip ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4036
"/                        (incSet includes:cc) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4037
"/                            nesting := nesting + 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4038
"/                        ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4039
"/                            (decSet includes:cc) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4040
"/                                nesting := nesting - 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4041
"/                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4042
"/                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4043
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4044
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4045
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4046
"/                nesting == 0 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4047
"/                    "check if legal"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4048
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4049
"/                    skip ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4050
"/                        cc == closingChar ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4051
"/                            ^ failBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4052
"/                        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4053
"/                        ^ foundBlock value:line value:runCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4054
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4055
"/                ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4056
"/            ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4057
"/        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4058
"/        line := line + delta.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4059
"/        (line < 1 or:[line > maxLine]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4060
"/            ^ failBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4061
"/        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4062
"/        lineString := list at:line.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4063
"/        direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4064
"/            col := 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4065
"/        ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4066
"/            col := lineString size
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4067
"/        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4068
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4069
"/    ^ notFoundBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4070
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4071
    "Modified: / 12-04-2007 / 11:25:36 / cg"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4072
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4073
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4074
searchForMatchingParenthesisFromLine:startLine col:startCol
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4075
		     ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4076
		  ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4077
		     onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4078
	   openingCharacters:openingCharacters
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4079
	   closingCharacters:closingCharacters
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4080
	   ignoredCharacters:ignoreSet
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4081
	  specialEOLComment:eolCommentSequence
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4082
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4083
    "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
  4084
     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
  4085
     backwards if its a closing parenthesis.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4086
     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
  4087
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4088
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4089
    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4090
     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4091
     ignoring
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4092
     line   "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4093
     col    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4094
     delta  "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4095
     endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4096
     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4097
     cc prevCC nextCC incSet decSet
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4098
     nesting "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4099
     maxLine "{ Class: SmallInteger }"
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4100
     ign skip anySet
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4101
     eol1 eol2|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4102
2772
4e04a3bf399f check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4103
    self assert:(openingCharacters size == closingCharacters size).
4e04a3bf399f check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4104
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4105
    charSet := openingCharacters , closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4106
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4107
    parChar := self characterAtLine:startLine col:startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4108
    i := charSet indexOf:parChar.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4109
    i == 0 ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4110
	^ failBlock value   "not a parenthesis"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4111
    ].
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4112
3858
1fd3e63fb456 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3851
diff changeset
  4113
    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
  4114
    closingChar := (closingCharacters , openingCharacters) at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4115
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4116
    eol1 := eolCommentSequence at:1 ifAbsent:nil.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4117
    eol2 := eolCommentSequence at:2 ifAbsent:nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4118
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4119
    col := startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4120
    line := startLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4121
    direction == #fwd ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4122
	delta := 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4123
	incSet := openingCharacters.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4124
	decSet := closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4125
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4126
	delta := -1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4127
	incSet := closingCharacters.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4128
	decSet := openingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4129
    ].
1454
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4130
    anySet := Set new.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4131
    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4132
    anySet := (anySet select:[:c | c isCharacter]) asString.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4133
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4134
    nesting := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4135
    ignoring := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4136
    lineString := list at:line.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4137
    maxLine := list size.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4138
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4139
    col := col + delta.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4140
    [nesting ~~ 0] whileTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4141
	(lineString notNil
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4142
	and:[lineString includesAny:anySet]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4143
	    direction == #fwd ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4144
		endCol := lineString size.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4145
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4146
		endCol := 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4147
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4148
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4149
	    col to:endCol by:delta do:[:rCol |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4150
		runCol := rCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4151
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4152
		cc := lineString at:runCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4153
		runCol < lineString size ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4154
		    nextCC := lineString at:runCol+1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4155
		] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4156
		    nextCC := nil
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4157
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4158
		runCol > 1 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4159
		    prevCC := lineString at:runCol-1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4160
		] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4161
		    prevCC := nil
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4162
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4163
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4164
		ign := skip := false.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4165
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4166
		"/ check for comments.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4167
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4168
		((cc == eol1 and:[nextCC == eol2])
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4169
		or:[prevCC == $$ ]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4170
		    "/ do nothing
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4171
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4172
		    skip := true.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4173
		] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4174
		    ignoreSet do:[:ignore |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4175
			ignore == cc ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4176
			    ign := true
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4177
			] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4178
			    ignore isString ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4179
				cc == (ignore at:2) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4180
				    runCol > 1 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4181
					(lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4182
					    skip := true
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4183
					]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4184
				    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4185
				] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4186
				    cc == (ignore at:1) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4187
					runCol < lineString size ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4188
					    (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4189
						skip := true
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4190
					    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4191
					]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4192
				    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4193
				]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4194
			    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4195
			]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4196
		    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4197
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4198
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4199
		ign ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4200
		    ignoring := ignoring not
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4201
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4202
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4203
		ignoring ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4204
		    skip ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4205
			(incSet includes:cc) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4206
			    nesting := nesting + 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4207
			] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4208
			    (decSet includes:cc) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4209
				nesting := nesting - 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4210
			    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4211
			]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4212
		    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4213
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4214
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4215
		nesting == 0 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4216
		    "check if legal"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4217
		    skip ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4218
			cc == closingChar ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4219
			    ^ failBlock value
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4220
			].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4221
			^ foundBlock value:line value:runCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4222
		    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4223
		]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4224
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4225
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4226
	line := line + delta.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4227
	(line < 1 or:[line > maxLine]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4228
	    ^ failBlock value
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4229
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4230
	lineString := list at:line.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4231
	direction == #fwd ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4232
	    col := 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4233
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4234
	    col := lineString size
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4235
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4236
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4237
    ^ notFoundBlock value
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4238
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  4239
    "Modified: 15.10.1996 / 12:22:30 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4240
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4241
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4242
searchFwd
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4243
    "search forward for the same pattern or selection again"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4244
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4245
    |ign match variable|
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  4246
2811
3a7aed97fd76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  4247
    searchAction notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4248
	"/ autosearch is cleared whenever there is search with user selection
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4249
	(self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
4177
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4250
    ].
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4251
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4252
    searchAction notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4253
	"/ confusing: this is for autosearch of variables (browse variable uses, for example)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4254
	self searchUsingSearchAction:#forward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4255
	^ self.
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4256
    ].
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  4257
    searchBarActionBlock notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4258
	searchBarActionBlock value:#forward value:self.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4259
	^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4260
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4261
    lastSearchWasVariableSearch ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4262
	variable := self syntaxElementForSelectedVariable.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4263
	variable notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4264
	    self searchVariableWithSyntaxElement:variable forward:true.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4265
	    ^ self.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4266
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4267
	lastSearchWasVariableSearch := false.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4268
    ].
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4269
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4270
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4271
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  4272
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4273
    selectStyle == #wordLeft ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4274
	"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4275
	 remove the space from the selection
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4276
	"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4277
	selectionStartCol := selectionStartCol + 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4278
	super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4279
	selectStyle := #word.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4280
	self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4281
    ].
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4282
    self setSearchPatternWithMatchEscapes: match.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4283
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4284
    lastSearchPattern isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4285
	LastSearchPatterns size > 0 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4286
	    lastSearchPattern := LastSearchPatterns first
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4287
	]
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4288
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4289
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4290
    lastSearchPattern notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4291
	self rememberSearchPattern:lastSearchPattern.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4292
	lastSearchDirection := #forward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4293
	self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4294
	    searchFwd:lastSearchPattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4295
	    ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4296
	    match: match
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4297
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4298
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4299
    "Modified: / 08-03-2012 / 14:25:42 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4300
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4301
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4302
searchFwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4303
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4304
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4305
    self searchFwd:pattern ifAbsent:[self showNotFound].
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4306
"/    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4307
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4308
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4309
    "Modified: / 21-09-2006 / 16:52:04 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4310
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4311
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4312
searchFwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4313
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4314
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4315
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4316
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4317
				pattern:pattern)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4318
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4319
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4320
    "Modified: / 21-09-2006 / 16:51:28 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4321
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4322
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4323
searchFwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4324
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4325
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4326
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4327
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4328
				pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4329
				ignoreCase:ign)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4330
	ifAbsent:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4331
		    self sensor compressKeyPressEventsWithKey:#FindNext.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4332
		    self showNotFound
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4333
		 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4334
    "/ lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4335
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4336
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4337
    "Created: / 13-09-1997 / 06:18:13 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4338
    "Modified: / 23-03-2012 / 12:09:59 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4339
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4340
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4341
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4342
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4343
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4344
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4345
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4346
				pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4347
				ignoreCase:ign)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4348
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4349
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4350
    "Modified: 13.9.1997 / 01:05:35 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4351
    "Created: 13.9.1997 / 06:18:27 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4352
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4353
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4354
searchFwd:pattern ignoreCase:ign match: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4355
    "do a forward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4356
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4357
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4358
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4359
				pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4360
				ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4361
				match:match)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4362
	ifAbsent:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4363
		    self sensor compressKeyPressEventsWithKey:#FindNext.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4364
		    self showNotFound
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4365
		 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4366
    "/ lastSearchIgnoredCase := ign.
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4367
    "/ lastSearchWasMatch := match.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4368
    lastSearchPattern := pattern string
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4369
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4370
    "Created: / 13-09-1997 / 06:18:13 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4371
    "Modified: / 23-03-2012 / 12:12:47 / cg"
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4372
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4373
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4374
searchFwd:pattern ignoreCase:ign match: match ifAbsent:aBlock
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4375
    "do a forward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4376
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4377
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4378
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4379
				pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4380
				ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4381
				match:match)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4382
	ifAbsent:aBlock
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4383
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4384
    "Modified: 13.9.1997 / 01:05:35 / cg"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4385
    "Created: 13.9.1997 / 06:18:27 / cg"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4386
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4387
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4388
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4389
    "do a forward search"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4390
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4391
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4392
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4393
				pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4394
				ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4395
				match:match)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4396
	startingAtLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4397
	ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4398
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4399
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4400
searchFwdUsingSpec:searchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4401
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4402
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4403
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4404
	searchFwdUsingSpec:searchSpec
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4405
	ifAbsent:[self showNotFound].
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4406
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4407
"/    lastSearchIgnoredCase := false.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4408
    lastSearchPattern := searchSpec pattern string
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4409
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4410
    "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
  4411
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4412
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4413
searchFwdUsingSpec:searchSpec ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4414
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4415
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4416
    |pos startLine startCol|
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4417
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4418
    pos := self startPositionForSearchForward.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4419
    startLine := pos y.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4420
    startCol := pos x.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4421
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4422
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4423
	searchFwdUsingSpec:searchSpec
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4424
	startingAtLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4425
	ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4426
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4427
    "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
  4428
    "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
  4429
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4430
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4431
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
  4432
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4433
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4434
    self
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  4435
        searchForwardUsingSpec:searchSpec
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  4436
        startingAtLine:startLine col:startCol
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4437
        ifFound:[:line :col :endColOrNil| 
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4438
            self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  4439
        ]
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  4440
        ifAbsent:aBlock
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4441
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4442
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4443
searchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4444
    "return the last search pattern"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4445
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4446
    ^ lastSearchPattern
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4447
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4448
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4449
searchUsingSearchAction:direction
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4450
    "search using a searchaction which has been given by someone else.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4451
     Typically, this is the embedding browser, which has provided an action for
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4452
      a language aware search (as opposed to a naive string search)"
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4453
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4454
    self
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4455
        searchUsingSearchAction:direction
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4456
        ifAbsent:[
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4457
                    self sensor compressKeyPressEventsWithKey:#FindNext.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4458
                    self showNotFound
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4459
                 ]
2816
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4460
!
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4461
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4462
searchUsingSearchAction:direction ifAbsent:notFoundAction
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4463
    "search using a searchaction which has been given by someone else.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4464
     Typically, this is the embedding browser, which has provided an action for
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4465
      a language aware search (as opposed to a naive string search)"
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4466
      
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4467
    |pos startLine startCol|
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4468
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4469
    pos :=  direction == #backward
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4470
                ifTrue:[self startPositionForSearchBackward]
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4471
                ifFalse:[self startPositionForSearchForward].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4472
    startLine := pos y.
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4473
    startCol := pos x.
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4474
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4475
    searchAction notNil ifTrue:[
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4476
        searchAction
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4477
            value:direction
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4478
            value:startLine
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4479
            value:startCol
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4480
            value:[:line :col | self selectFromLine:line toLine:line]
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4481
            value:notFoundAction.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4482
        self hasSelection ifTrue: [
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4483
            self changeTypeOfSelectionTo: #searchAction.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4484
        ].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4485
    ].
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4486
!
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4487
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4488
setSearchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4489
    "set the searchpattern from the selection if there is one"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4490
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4491
    self setSearchPatternWithMatchEscapes: false.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4492
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4493
3904
dd4c2dace4f5 changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents: 3892
diff changeset
  4494
setSearchPattern:aStringOrNil
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4495
    "set the searchpattern for future searches"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4496
3904
dd4c2dace4f5 changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents: 3892
diff changeset
  4497
    aStringOrNil isEmptyOrNil ifTrue:[
5247
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
  4498
        lastSearchPattern := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4499
    ] ifFalse:[
5247
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
  4500
        "/ not withoutSeparators: may want to search for spaces...
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
  4501
        lastSearchPattern := aStringOrNil asString "withoutSeparators" string.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4502
    ].
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4503
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4504
    "Modified: / 6.3.1999 / 23:47:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4505
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4506
2200
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4507
setSearchPattern:aString ignoreCase:aBoolean
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4508
    "set the searchpattern and caseIgnore for future searches"
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4509
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4510
    self setSearchPattern:aString.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4511
    lastSearchIgnoredCase := aBoolean.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4512
!
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4513
5713
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4514
setSearchPattern:aString ignoreCase:ignoreCaseBoolean match:matchBoolean
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4515
    "set the searchpattern and caseIgnore for future searches"
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4516
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4517
    self setSearchPattern:aString.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4518
    lastSearchIgnoredCase := ignoreCaseBoolean.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4519
    lastSearchWasMatch := matchBoolean.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4520
!
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4521
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4522
setSearchPatternWithMatchEscapes: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4523
    "set the searchpattern from the selection if there is one"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4524
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4525
    |sel searchPattern |
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4526
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4527
"/    clickPos isNil ifTrue:[^ self].
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4528
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4529
    sel := self selection.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4530
    sel notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4531
	searchPattern := sel asString.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4532
	match ifTrue:[searchPattern := searchPattern withMatchEscapes].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4533
	self setSearchPattern:searchPattern.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4534
    ]
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4535
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4536
    "Modified: / 6.3.1999 / 23:48:04 / cg"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4537
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4538
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4539
showMatch:pattern atLine:line col:col
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4540
    <resource: #obsolete>
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4541
    "after a search, highlight the matched pattern.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4542
     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
  4543
     (for now, it only highlights simple patterns and '*string*' correctly)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4544
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4545
    self showMatch:pattern isMatch:true atLine:line col:col endCol:nil
4120
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4546
!
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4547
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4548
showMatch:pattern isMatch:isMatch atLine:line col:col
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4549
    <resource: #obsolete>
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4550
    "after a search, highlight the matched pattern."
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4551
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4552
    self showMatch:pattern isMatch:isMatch atLine:line col:col endCol:nil
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4553
!
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4554
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4555
showMatch:pattern isMatch:isMatch atLine:line col:col endCol:encColOrNil
4120
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4556
    "after a search, highlight the matched pattern.
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4557
     The code below needs a rewrite to take care of match-characters
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4558
     (for now, it only highlights simple patterns and '*string*' correctly)"
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4559
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4560
    |endCol realPattern|
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4561
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4562
    (endCol := encColOrNil) isNil ifTrue:[
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4563
        "/ a hack.
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4564
        realPattern := pattern.
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4565
        isMatch ifTrue: [
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4566
            (realPattern startsWith:$*) ifTrue:[
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4567
                realPattern := realPattern copyButFirst
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4568
            ].
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4569
            (realPattern endsWith:$*) ifTrue:[
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4570
                realPattern := realPattern copyButLast
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4571
            ].
4567
33be833bfcbf Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4554
diff changeset
  4572
        ].
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4573
        endCol := (col + realPattern size - 1).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4574
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4575
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4576
    self selectFromLine:line col:col toLine:line col:endCol.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4577
    self makeLineVisible:line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4578
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4579
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4580
showNotFound
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4581
    "search not found - tell user by beeping and changing
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4582
     cursor for a while (sometimes I work with a headset :-)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4583
     (used to be: tell user by changing cursor for a while)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4584
5052
70780a6ab673 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5046
diff changeset
  4585
    self withCursor:(Cursor cross) do:[
70780a6ab673 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5046
diff changeset
  4586
        self beep.
70780a6ab673 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5046
diff changeset
  4587
        Processor activeProcess millisecondDelay:200.
1028
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4588
    ]
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4589
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4590
    "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
  4591
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4592
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4593
startPositionForSearchBackward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4594
    ^ self startPositionForSearchBackwardBasedOnSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4595
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4596
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4597
startPositionForSearchBackwardBasedOnSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4598
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4599
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4600
    selectionStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4601
	startLine := selectionStartLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4602
	startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4603
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4604
	startLine := 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4605
	startCol := 1
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4606
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4607
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4608
    ^ startCol @ startLine
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4609
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4610
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4611
startPositionForSearchForward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4612
    ^ self startPositionForSearchForwardBasedOnSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4613
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4614
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4615
startPositionForSearchForwardBasedOnSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4616
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4617
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4618
    selectionStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4619
	startLine := selectionStartLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4620
	startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4621
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4622
	startLine := 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4623
	startCol := 1
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4624
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4625
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4626
    ^ startCol @ startLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4627
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4628
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4629
!TextView methodsFor:'selections'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4630
2604
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4631
changeTypeOfSelectionTo:newType
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4632
    "ignored here - but redefined in subclasses which
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4633
     differentiate between pasted- and user-selections"
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4634
!
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4635
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4636
expandSelectionDown
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4637
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4638
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4639
    selectionStartLine notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4640
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4641
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4642
	    selectionStartLine := selectionStartLine + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4643
	    (selectionStartLine > clickLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4644
	    or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4645
	    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4646
		t := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4647
		selectionStartLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4648
		selectionEndLine := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4649
		t := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4650
		selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4651
		selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4652
		expandingTop := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4653
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4654
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4655
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4656
	    selectionEndLine := selectionEndLine + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4657
	].
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4658
"/        self redrawLine:l.
2442
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4659
"/        self redrawLine:l+1.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4660
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4661
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4662
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4663
	self redrawFromLine:l to:l+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4664
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4665
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4666
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4667
    "Created: / 01-03-1996 / 23:35:08 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4668
    "Modified: / 18-03-1996 / 17:18:15 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4669
    "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
  4670
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4671
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4672
expandSelectionLeft
502
6f3d0d7a782c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  4673
    |c l t c1 c2|
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4674
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4675
    selectionStartLine notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4676
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4677
	    selectionStartCol == 0 ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4678
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4679
	    selectionStartCol := (selectionStartCol - 1) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4680
	    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4681
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4682
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4683
	    selectionEndCol := (selectionEndCol - 1) max:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4684
	    c := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4685
	    selectionEndLine == selectionStartLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4686
		selectionEndCol <= selectionStartCol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4687
		    t := selectionStartCol. selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4688
		    selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4689
		    expandingTop := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4690
		    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4691
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4692
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4693
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4694
	c1 := c.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4695
	c2 := c1 + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4696
	c1 == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4697
	    c1 := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4698
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4699
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4700
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4701
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4702
	self redrawLine:l from:c1 to:c2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4703
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4704
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4705
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4706
    "Modified: / 18-03-1996 / 17:05:46 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4707
    "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
  4708
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4709
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4710
expandSelectionRight
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4711
    |l c t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4712
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4713
    selectionStartLine notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4714
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4715
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4716
	    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4717
	    selectionStartCol := selectionStartCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4718
	    l == selectionEndLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4719
		c >= selectionEndCol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4720
		    expandingTop := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4721
		    t := selectionStartCol. selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4722
		    selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4723
		    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4724
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4725
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4726
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4727
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4728
	    c := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4729
	    selectionEndCol := selectionEndCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4730
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4731
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4732
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4733
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4734
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4735
	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
  4736
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4737
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4738
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4739
    "Created: / 01-03-1996 / 23:33:17 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4740
    "Modified: / 06-03-1996 / 13:54:10 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4741
    "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
  4742
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4743
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4744
expandSelectionUp
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4745
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4746
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4747
    selectionStartLine notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4748
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4749
	    selectionStartLine := (selectionStartLine - 1) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4750
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4751
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4752
	    selectionEndLine := (selectionEndLine - 1) max:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4753
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4754
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4755
	    (selectionEndLine < clickLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4756
	    or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4757
	    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4758
		t := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4759
		selectionStartLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4760
		selectionEndLine := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4761
		t := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4762
		selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4763
		selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4764
		l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4765
		expandingTop := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4766
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4767
	].
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.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4771
	"/ self redrawLine:l.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4772
	"/ self redrawLine:l+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4773
	self redrawFromLine:l to:l+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4774
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4775
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4776
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4777
    "Modified: / 06-03-1996 / 14:12:06 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4778
    "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
  4779
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4780
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4781
hasSelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4782
    "return true, if there is a selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4783
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4784
    ^ selectionStartLine notNil
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4785
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4786
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4787
hasSelectionForCopy
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4788
    "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
  4789
     (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
  4790
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4791
    ^ self hasSelection
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4792
!
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4793
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4794
hasSelectionWithinSingleLine
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4795
    "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
  4796
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4797
    ^ selectionStartLine notNil
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4798
      and:[ selectionStartLine == selectionEndLine ]
3315
1b42d2f8dcbc CRLF management
fm
parents: 3308
diff changeset
  4799
1b42d2f8dcbc CRLF management
fm
parents: 3308
diff changeset
  4800
    "Modified: / 04-07-2006 / 18:42:59 / fm"
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4801
!
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4802
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4803
hasSingleFullLineSelected
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4804
    ^ (selectionStartLine notNil
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4805
      and:[selectionEndLine notNil
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4806
      and:[selectionEndLine == (selectionStartLine+1)
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4807
      and:[selectionStartCol == 1
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4808
      and:[selectionEndCol == 0
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4809
    ]]]])
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4810
!
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4811
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4812
isInSelection:line col:aColNr
96256221e3af support drag
ca
parents: 2581
diff changeset
  4813
    "returns true, if the line, and column is in the selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  4814
    "
3438
d83030fd5005 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3426
diff changeset
  4815
    selectionStartLine isNil ifTrue:[^ false].
d83030fd5005 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3426
diff changeset
  4816
    selectionEndLine   isNil ifTrue:[^ false].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4817
96256221e3af support drag
ca
parents: 2581
diff changeset
  4818
    (line between:selectionStartLine and:selectionEndLine) ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4819
	^ false
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4820
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  4821
96256221e3af support drag
ca
parents: 2581
diff changeset
  4822
    line == selectionStartLine ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4823
	aColNr < selectionStartCol ifTrue:[^ false]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4824
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  4825
96256221e3af support drag
ca
parents: 2581
diff changeset
  4826
    line == selectionEndLine ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4827
	(selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4828
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  4829
    ^ true
96256221e3af support drag
ca
parents: 2581
diff changeset
  4830
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  4831
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4832
makeSelectionVisible
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4833
    "scroll to make the selection visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4834
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4835
    |line col|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4836
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4837
    selectionStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4838
	expandingTop == true ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4839
	    line := selectionStartLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4840
	    col := selectionStartCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4841
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4842
	    line := selectionEndLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4843
	    col := selectionEndCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4844
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4845
	self makeLineVisible:line.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4846
	self makeColVisible:col inLine:line.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4847
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4848
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4849
    "Modified: 6.3.1996 / 13:53:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4850
!
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
selectAll
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4853
    "select the whole text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4854
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4855
    self selectFromLine:1 col:1 toLine:(list size + 1) col:0
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4856
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4857
4140
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4858
selectFromCharacterPosition:pos1
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4859
    "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
  4860
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4861
    |line1 col1 line2 col2|
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4862
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4863
    line1 := self lineOfCharacterPosition:pos1.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4864
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4865
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4866
    line2 := (list size + 1).
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4867
    col2 := 0.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4868
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4869
!
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4870
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4871
selectFromCharacterPosition:pos1 to:pos2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4872
    "compute line/col from character positions and select the text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4873
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4874
    |line1 col1 line2 col2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4875
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4876
    pos1 > pos2 ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4877
	^ self unselect
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4878
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4879
    line1 := self lineOfCharacterPosition:pos1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4880
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4881
    col1 < 1 ifTrue:[ col1 := 1 ].
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4882
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4883
    line2 := self lineOfCharacterPosition:pos2.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4884
    col2 := pos2 - (self characterPositionOfLine:line2 col:1) + 1.
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4885
    col2 < 1 ifTrue:[ col2 := 1 ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4886
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4887
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4888
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4889
selectFromLine:startLine col:startCol toLine:endLine col:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4890
    "select a piece of text and redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4891
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4892
    | oldStartCol oldEndCol oldStartLine oldEndLine |
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4893
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4894
    oldStartCol := selectionStartCol ? startCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4895
    oldStartLine := selectionStartLine ? startLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4896
    oldEndCol := selectionEndCol ? endCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4897
    oldEndLine := selectionEndLine ? endLine.  
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4898
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4899
    self unselectWithoutRedraw.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4900
    startLine notNil ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4901
	"new:"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4902
	endLine < startLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4903
	    ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4904
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4905
	(endLine == startLine and:[endCol < startCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4906
	    endCol ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4907
		self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4908
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4909
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4910
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4911
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4912
        " old:
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4913
	endLine < startLine ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4914
	(startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4915
        "
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4916
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4917
	selectionStartLine := startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4918
	selectionStartCol := startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4919
	selectionEndLine := endLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4920
	selectionEndCol := endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4921
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4922
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4923
	self selectionChanged.
4787
cc11ec8d6855 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4785
diff changeset
  4924
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4925
        (selectionStartLine == selectionEndLine 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4926
            and:[oldStartLine == selectionStartLine 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4927
                and:[oldEndLine == selectionEndLine]]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4928
                    self redrawLine:selectionStartLine 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4929
                               from:(selectionStartCol min: oldStartCol) 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4930
                                 to:(selectionEndCol max: oldEndCol)
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4931
                ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4932
                    (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
  4933
                        self redrawLine:lineNr
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4934
                    ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  4935
                ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4936
	selectStyle := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4937
    ]
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4938
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4939
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4940
     |v|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4941
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4942
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4943
     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
  4944
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4945
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4946
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4947
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4948
     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
  4949
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4950
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4951
    "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
  4952
    "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
  4953
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4954
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4955
selectFromLine:startLine toLine:endLine
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4956
    "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
  4957
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4958
    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
  4959
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4960
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4961
     |v|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4962
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4963
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4964
     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
  4965
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4966
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4967
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4968
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4969
     v selectFromLine:2 toLine:10
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4970
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4971
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4972
    "Modified: 29.4.1996 / 12:23:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4973
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4974
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4975
selectLine:selectLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4976
    "select one line and redraw it"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4977
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4978
    self selectFromLine:selectLine col:1 toLine:(selectLine + 1) col:0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4979
    wordStartCol := selectionStartCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4980
    wordEndCol := selectionEndCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4981
    wordStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4982
    wordEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4983
    selectStyle := #line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4984
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4985
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4986
selectLineAtY:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4987
    "select the line at given y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4988
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  4989
    |selectLine|
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  4990
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  4991
    selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4992
    selectLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4993
	self selectLine:selectLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4994
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4995
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4996
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4997
selectLineWhereCharacterPosition:pos
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4998
    "select the line, where characterPosition pos is living.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4999
     The argument pos starts at 1 from the start of the text
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  5000
     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
  5001
     character position within a string to line-position in view)."
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
    self selectLine:(self lineOfCharacterPosition:pos)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5004
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5005
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5006
selectWordAtLine:line col:col
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5007
    "select the word at given line/col"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5008
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  5009
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5010
	wordAtLine:line col:col do:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5011
	    :beginLine :beginCol :endLine :endCol :style |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5012
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5013
	    self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5014
	    selectStyle := style
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5015
	]
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5016
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5017
    "Modified: 18.3.1996 / 17:30:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5018
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5019
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5020
selectWordAtX:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5021
    "select the word at given x/y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5022
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5023
    |selectVisibleLine selectLine selectCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5024
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5025
    selectStyle := nil.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5026
    selectVisibleLine := self visibleLineOfY:y.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5027
    selectLine := self visibleLineToListLine:selectVisibleLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5028
    selectLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5029
	selectCol := self colOfX:x inVisibleLine:selectVisibleLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5030
	self selectWordAtLine:selectLine col:selectCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5031
    ]
1661
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5032
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5033
    "Modified: / 8.9.1998 / 21:22:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5034
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5035
3528
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5036
selectedInterval
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5037
    "return the selection-boundaries as interval"
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5038
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5039
    ^ self selectionStartIndex to:(self selectionStopIndex - 1)
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5040
!
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5041
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5042
selection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5043
    "return the selection as a collection of (line-)strings.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5044
     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
  5045
     collection will be an empty string."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5046
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5047
    |sel|
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5048
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5049
    selectionStartLine isNil ifTrue:[^ nil].
4466
5c7a01426564 changed: #selection
Claus Gittinger <cg@exept.de>
parents: 4462
diff changeset
  5050
    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
  5051
    sel notEmptyOrNil ifTrue:[
5658
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5052
        "/ this is rubbish; we are now always using unicode internally
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5053
        "/ any many more conversions would be needed at many places...
5660
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5649 5658
diff changeset
  5054
        (gc characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5649 5658
diff changeset
  5055
            sel := sel encodeFrom:gc characterEncoding into:#'iso10646-1'
5391
98080a3105ae class: TextView
Claus Gittinger <cg@exept.de>
parents: 5378
diff changeset
  5056
        ].
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5057
    ].
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5058
    ^ sel
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
  5059
4361
646cd7c5513e comment/format in: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents: 4321
diff changeset
  5060
    "Modified (comment): / 25-01-2012 / 00:29:09 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5061
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5062
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5063
selectionAsString
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5064
    "return the selection as a String (i.e. without emphasis)"
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5065
2693
9e7da8ff444d unused methodLocals removed
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
  5066
    |sel|
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5067
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5068
    (sel := self selection) isNil ifTrue:[^ nil].
2419
2ae3350454bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  5069
    sel := sel collect:[:each| each isNil ifTrue:[nil] ifFalse:[each string]].
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5070
    ^ (sel asStringWithCRsFrom:1 to:(sel size) compressTabs:false withCR:false) string
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5071
!
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5072
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5073
selectionChanged
5658
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5074
    "can be redefined for notification or special actions.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5075
     If you do, do not forget to do a super selectionChanged"
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5076
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5077
    self changed:#selection.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5078
"/    self selectionHolder value:{ selectionStartCol @ selectionStartLine .
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5079
"/                                 selectionEndCol @ selectionEndLine }
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5080
!
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5081
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5082
selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5083
    ^ selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5084
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5085
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5086
selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5087
    ^ selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5088
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5089
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5090
selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5091
    ^ selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5092
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5093
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5094
selectionStartLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5095
    ^ selectionStartLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5096
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5097
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5098
setPrimarySelection
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5099
    "can be redefined for notification or special actions"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5100
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5101
    device notNil ifTrue:[
5087
001f9ac320b2 Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5086 5023
diff changeset
  5102
        "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
  5103
         (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5104
	device setPrimaryText: self selectionAsString ownerView: self.
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5105
    ].
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5106
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5107
    "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
  5108
!
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5109
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5110
st80SelectMode
3459
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5111
    st80SelectMode notNil ifTrue:[^ st80SelectMode].
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5112
    ^ self class st80SelectMode
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5113
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5114
    "Created: / 03-07-2006 / 16:30:59 / cg"
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5115
!
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5116
3459
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5117
st80SelectMode:aBoolean
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5118
    st80SelectMode := aBoolean
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5119
!
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5120
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5121
unselect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5122
    "unselect - if there was a selection redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5123
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5124
    |startLine endLine startVisLine endVisLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5125
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5126
    selectionStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5127
	startLine := selectionStartLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5128
	endLine := selectionEndLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5129
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5130
	self unselectWithoutRedraw.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5131
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5132
	"/ if the selection is not visible, we are done
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5133
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5134
	startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5135
	endLine < firstLineShown ifTrue:[^ self].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5136
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5137
	startLine < firstLineShown ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5138
	    startVisLine := 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5139
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5140
	    startVisLine := self listLineToVisibleLine:startLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5141
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5142
	endLine >= (firstLineShown + nLinesShown) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5143
	    endVisLine := nLinesShown
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5144
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5145
	    endVisLine := self listLineToVisibleLine:endLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5146
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5147
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5148
	"/ if its only part of a line, just redraw what has to be
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5149
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5150
	(startLine == endLine) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5151
	    super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5152
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5153
	    self redrawFromVisibleLine:startVisLine to:endVisLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5154
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5155
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5156
    selectStyle := nil
503
468d4a36ed67 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
  5157
715
a5856fcdbf0f fixed unselect-redraw
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  5158
    "Modified: 29.5.1996 / 14:54:11 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5159
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5160
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5161
unselectWithoutRedraw
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5162
    "forget selection but do not redraw the selection area
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5163
     - 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
  5164
     known to be invisible (however, redraw knows about that anyway)."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5165
2735
5ba2010aefa4 *** empty log message ***
penk
parents: 2730
diff changeset
  5166
    selectionStartLine := selectionEndLine := nil.
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5167
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5168
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5169
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5170
validateNewSelection
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5171
     "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
  5172
      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
  5173
      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
  5174
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5175
    ^ self
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5176
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5177
    "Modified: 29.4.1996 / 12:32:08 / cg"
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5178
!
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5179
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5180
withSelectionForeground:hilightFg background:hilightBg do:aBlock
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5181
    "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
  5182
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5183
    |oldFg oldBg|
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5184
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5185
    "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5186
     change color of selection & hide cursor
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5187
    "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5188
    oldFg := selectionFgColor.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5189
    oldBg := selectionBgColor.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5190
    selectionBgColor := hilightBg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5191
    selectionFgColor := hilightFg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5192
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5193
    expandingTop := true.       "/ hack to make the top of the selection visible
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5194
    self makeSelectionVisible.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5195
    selectionStartLine notNil ifTrue:[
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5196
        selectionEndLine notNil ifTrue:[
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5197
            self redrawFromLine:selectionStartLine to:selectionEndLine.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5198
        ].
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5199
    ].
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5200
    self flush.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5201
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5202
    aBlock ensure:[
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5203
        "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5204
         undo selection color change and show cursor again
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5205
        "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5206
        selectionFgColor := oldFg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5207
        selectionBgColor := oldBg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5208
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5209
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5210
4310
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5211
!TextView methodsFor:'testing'!
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5212
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5213
isTextView
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5214
    "I am showing text"
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5215
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5216
    ^ true
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5217
! !
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5218
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  5219
!TextView class methodsFor:'documentation'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5220
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5221
version
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  5222
    ^ '$Header$'
3964
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5223
!
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5224
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5225
version_CVS
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  5226
    ^ '$Header$'
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  5227
!
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  5228
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  5229
version_HG
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  5230
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4667
diff changeset
  5231
    ^ '$Changeset: <not expanded> $'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5232
! !
2630
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
  5233
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  5234
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  5235
TextView initialize!