TextView.st
author Stefan Vogel <sv@exept.de>
Tue, 19 Jul 2016 21:45:20 +0200
changeset 5789 a6db617369e9
parent 5786 e7eeb2edbed5
child 5791 7594f171ab4d
permissions -rw-r--r--
Delegate GraphicsContext objects
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
"
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
    12
'From Smalltalk/X, Version:7.1.0.0 on 15-07-2016 at 17:19:36'                   !
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
    13
2191
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    14
"{ Package: 'stx:libwidg' }"
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    15
5247
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
    16
"{ NameSpace: Smalltalk }"
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
    17
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
ListView subclass:#TextView
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    19
	instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    20
		selectionEndCol clickPos clickStartLine clickStartCol clickLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    21
		clickCol clickCount expandingTop wordStartCol wordStartLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    22
		wordEndCol wordEndLine selectionFgColor selectionBgColor
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    23
		selectStyle directoryForFileDialog defaultFileNameForFileDialog
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    24
		externalEncoding contentsWasSaved searchAction lastSearchPattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    25
		lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    26
		lastSearchWasVariableSearch parenthesisSpecification dropSource
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    27
		dragIsActive saveAction st80SelectMode searchBarActionBlock'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    28
	classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    29
		DefaultSelectionBackgroundColor
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    30
		DefaultAlternativeSelectionForegroundColor
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    31
		DefaultAlternativeSelectionBackgroundColor MatchDelayTime
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    32
		WordSelectCatchesBlanks LastSearchPatterns
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    33
		NumRememberedSearchPatterns LastSearchIgnoredCase
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    34
		LastSearchWasMatch DefaultParenthesisSpecification
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    35
		LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    36
		LastSearchWasReplace LastSearchReplacedString'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    37
	poolDictionaries:''
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    38
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    39
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    40
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
    41
!TextView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    42
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    43
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    44
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    45
 COPYRIGHT (c) 1989 by Claus Gittinger
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    46
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    47
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    48
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    49
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    50
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    51
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    52
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    53
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    54
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    55
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    56
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
    57
documentation
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    58
"
120
claus
parents: 119
diff changeset
    59
    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
    60
    The text is not editable and there is no cursor.
120
claus
parents: 119
diff changeset
    61
    Use TextViews for readonly text, EditTextView for editable text.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    62
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
    63
    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
    64
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
    65
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    66
120
claus
parents: 119
diff changeset
    67
      selectionStartLine      <Number>                the line of the selection start (or nil)
claus
parents: 119
diff changeset
    68
      selectionStartCol       <Number>                the col of the selection start
claus
parents: 119
diff changeset
    69
      selectionEndLine        <Number>                the line of the selection end
claus
parents: 119
diff changeset
    70
      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
    71
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    72
      clickStartLine          <Number>                temporary - remember where select operation started
120
claus
parents: 119
diff changeset
    73
      clickStartCol           <Number>                temporary
claus
parents: 119
diff changeset
    74
      clickLine               <Number>                temporary
claus
parents: 119
diff changeset
    75
      clickCol                <Number>                temporary
claus
parents: 119
diff changeset
    76
      clickCount              <Number>                temporary
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    77
      expandingTop            <Boolean>               temporary - for expandSelection
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    78
120
claus
parents: 119
diff changeset
    79
      selectionFgColor        <Color>                 color used to draw selections
claus
parents: 119
diff changeset
    80
      selectionBgColor        <Color>                 color used to draw selections
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
      selectStyle             <Symbol>                how words are selected
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
      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
    85
120
claus
parents: 119
diff changeset
    86
      contentsWasSaved        <Boolean>               set to true, whenever saved in a file
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
    87
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
    88
      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
    89
						      a file. Usually something like
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    90
						      #jis7, #euc, #sjis etc.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    91
						      (currently only passed down from the
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    92
						       fileBrowser)
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
    93
96256221e3af support drag
ca
parents: 2581
diff changeset
    94
      dropSource              <DropSource>            drag operation descriptor or nil (dragging disabled)
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    95
      dragIsActive            <Boolean>               true, drag operation is activated
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    96
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    97
      searchAction            <Block>                 an autosearch action; typically set by the browser.
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    98
						      Will be used as default when searchFwd/searchBwd is
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
    99
						      pressed. If the searchPattern is changed, no autosearch
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   100
						      action will be executed.
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   101
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   102
      searchBarActionBlock    <Block>                 search action block for embedded search
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   103
						      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
   104
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   105
    [class variables:]
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   106
	ST80Selections        <Boolean>               enables ST80 style doubleclick behavior
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   107
						      (right after opening parenthesis, right before
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   108
						       closing parenthesis, at begin of a line
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   109
						       at begin of text)
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   110
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   111
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   112
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   113
      textView.background                       defaults to viewBackground
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   114
      textView.ViewFont                         defaults to textFont
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.st80Selections                       st80 behavior (click on char after parent or quote)
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   117
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   118
      text.selectionForegroundColor             defaults to textBackgroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   119
      text.selectionBackgroundColor             defaults to textForegroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   120
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   121
      text.alternativeSelectionForegroundColor  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 selectionForegroundColor
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   123
      text.alternativeSelectionBackgroundColor  pasted text (i.e. paste will not replace)
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   124
						defaults to selectionBackgroundColor
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   125
    [author:]
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   126
	Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   127
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   128
    [see also:]
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   129
	EditTextView CodeView Workspace
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   130
"
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   131
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   132
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   133
examples
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   134
"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   135
    although textViews (and instances of subclasses) are mostly used
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   136
    as components (in the fileBrowser, the browser, the launcher etc.),
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   137
    they may also be opened as a textEditor;
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   138
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   139
    open a (readonly) textView on some information text:
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   140
							[exBegin]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   141
	TextView
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   142
	    openWith:'read this'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   143
	    title:'demonstration'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   144
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   145
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   146
    the same, but open it modal:
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   147
							[exBegin]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   148
	TextView
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   149
	    openModalWith:'read this first'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   150
	    title:'demonstration'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   151
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   152
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   153
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   154
    open it modal (but editable) on some text:
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   155
    (must accept before closing)
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   156
    This is somewhat kludgy - when closed, the view has already
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   157
    nilled its link to the model. Therefore, the accept must be
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   158
    done 'manually' below.
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   159
    However, usually an applicationModel is installed as the
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   160
    editor-topViews application. This would get a closeRequest,
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   161
    where it could handle things.
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   162
							[exBegin]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   163
	|m textView|
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   164
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   165
	m := 'read this first' asValue.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   166
	textView := EditTextView openModalOnModel:m.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   167
	textView modified ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   168
	    (self confirm:'text was not accepted - do it now ?')
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   169
	    ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   170
		m value:textView contents
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
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   173
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   174
	Transcript showCR:m value.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   175
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   176
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   177
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   178
    open a textEditor on some file:
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   179
							[exBegin]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   180
	EditTextView openOn:'Makefile'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   181
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   182
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   183
"
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   184
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   185
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   186
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   187
!TextView class methodsFor:'instance creation'!
119
claus
parents: 97
diff changeset
   188
claus
parents: 97
diff changeset
   189
on:aModel aspect:aspect change:change menu:menu initialSelection:initial
claus
parents: 97
diff changeset
   190
    "for ST-80 compatibility"
claus
parents: 97
diff changeset
   191
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   192
    ^ (self new)
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   193
	on:aModel
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   194
	aspect:aspect
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   195
	list:aspect
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   196
	change:change
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   197
	menu:menu
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   198
	initialSelection:initial
3280
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   199
!
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   200
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   201
with:someText
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   202
    ^ (self new)
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   203
	contents:someText
119
claus
parents: 97
diff changeset
   204
! !
claus
parents: 97
diff changeset
   205
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   206
!TextView class methodsFor:'class initialization'!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   207
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   208
initialize
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   209
    DefaultParenthesisSpecification isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   210
	DefaultParenthesisSpecification := IdentityDictionary new.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   211
	DefaultParenthesisSpecification at:#open        put:#( $( $[ ${ "$> $<") .
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   212
	DefaultParenthesisSpecification at:#close       put:#( $) $] $} "$> $<").
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   213
	DefaultParenthesisSpecification at:#ignore      put:#( $' $" '$[' '$]' '${' '$)' ).
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   214
	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
   215
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   216
! !
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   217
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   218
!TextView class methodsFor:'defaults'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
   219
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   220
defaultIcon
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   221
    "return the default icon if started as a topView"
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   222
3496
8c92a96c4e27 icon resource
Claus Gittinger <cg@exept.de>
parents: 3491
diff changeset
   223
    <resource: #programImage>
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   224
    <resource: #style (#ICON #ICON_FILE)>
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   225
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   226
    |nm i|
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   227
1146
027884518745 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   228
    i := self classResources at:'ICON' default:nil.
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   229
    i isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   230
	nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   231
	i := Smalltalk imageFromFileNamed:nm forClass:self.
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   232
    ].
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   233
    i notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   234
	i := i onDevice:Display
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   235
    ].
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   236
    ^ i
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   237
3496
8c92a96c4e27 icon resource
Claus Gittinger <cg@exept.de>
parents: 3491
diff changeset
   238
    "Modified: / 17-09-2007 / 11:36:29 / cg"
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   239
!
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   240
910
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   241
defaultMenuMessage
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   242
    "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
   243
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   244
    ^ #editMenu
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
    "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
   247
!
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   248
4254
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   249
defaultParenthesisSpecification
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   250
    ^ DefaultParenthesisSpecification
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
    "Created: / 14-06-2011 / 14:00:59 / cg"
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   253
!
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   254
2306
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   255
defaultSelectionBackgroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   256
    "return the default selection background color"
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
    ^DefaultSelectionBackgroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   259
!
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   260
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   261
defaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   262
    "return the default selection foreground color"
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
    ^DefaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   265
!
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   266
1477
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   267
defaultViewBackgroundColor
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   268
    "return the default view background"
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
    ^DefaultViewBackground
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   271
!
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   272
3226
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   273
lastSearchIgnoredCase
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   274
    ^ LastSearchIgnoredCase
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   275
!
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   276
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   277
lastSearchWasMatch
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   278
    ^ LastSearchWasMatch
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   279
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   280
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   281
st80SelectMode
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   282
    ^ UserPreferences current st80SelectMode
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   283
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   284
    "Modified: / 03-07-2006 / 16:26:44 / cg"
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   285
!
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   286
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   287
st80SelectMode:aBoolean
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   288
    UserPreferences current st80SelectMode:aBoolean
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   289
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   290
    "Created: / 07-01-1999 / 13:35:24 / cg"
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   291
    "Modified: / 03-07-2006 / 16:27:01 / cg"
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   292
!
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   293
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
   294
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   295
    "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
   296
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   297
    <resource: #style (#'textView.background'
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   298
		       #'text.selectionForegroundColor'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   299
		       #'text.selectionBackgroundColor'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   300
		       #'text.alternativeSelectionForegroundColor'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   301
		       #'text.alternativeSelectionBackgroundColor'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   302
		       #'textView.font'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   303
		       #'text.wordSelectCatchesBlanks'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   304
		       #'text.st80Selections')>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   305
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   306
    DefaultViewBackground := StyleSheet colorAt:'textView.background' default:Color white.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   307
    DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   308
    DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'.
2630
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   309
"/    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
   310
"/    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
   311
    DefaultAlternativeSelectionForegroundColor := DefaultSelectionForegroundColor.
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   312
    DefaultAlternativeSelectionBackgroundColor := DefaultSelectionBackgroundColor.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   313
    DefaultFont := StyleSheet fontAt:'textView.font'.
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
   314
    MatchDelayTime := 0.6.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   315
    WordSelectCatchesBlanks := StyleSheet at:'text.wordSelectCatchesBlanks' default:false.
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   316
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   317
    "Modified: / 03-07-2006 / 16:29:42 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   318
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   319
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   320
!TextView class methodsFor:'help specs'!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   321
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   322
flyByHelpSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   323
    "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
   324
     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
   325
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   326
    "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
   327
     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
   328
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   329
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   330
     UIHelpTool openOnClass:TextView
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   331
    "
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   332
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   333
    <resource: #help>
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
    ^ Dictionary new addPairsFrom:#(
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   336
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   337
#matchSearch
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   338
'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
   339
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   340
#searchCaseSensitive
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   341
'Care for case differences'
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   342
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   343
#searchFullWord
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   344
'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
   345
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   346
#searchAtBeginOfLineOnly
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   347
'Search only for the string at the beginning of a line'
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   348
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   349
#searchPattern
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   350
'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
   351
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   352
#searchVariable
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   353
'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
   354
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   355
#replaceText
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   356
'If checked, matching text is replaced by this'
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   357
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   358
#selectLines
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   359
'If checked, lines containing the matched string are selected.'
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   360
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   361
#replacePreserveCase
5727
59553507b326 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5726
diff changeset
   362
'Preserve the title case of replaced text'
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   363
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   364
#replaceAll
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   365
'Search and replace all occurrences of the searched string'
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   366
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   367
#searchWithWrap
5726
04a5c547c98f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5716
diff changeset
   368
'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
   369
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   370
#matchWithRegex
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   371
'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
   372
)
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   373
! !
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   374
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   375
!TextView class methodsFor:'interface specs'!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   376
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   377
searchDialogSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   378
    "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
   379
     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
   380
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   381
    "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
   382
     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
   383
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
     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
   386
    "
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   387
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   388
    <resource: #canvas>
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   389
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   390
    ^
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   391
    #(FullSpec
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   392
       name: searchDialogSpec
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   393
       window:
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   394
      (WindowSpec
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   395
	 label: 'String search'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   396
	 name: 'String search'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   397
	 min: (Point 10 10)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   398
	 max: (Point 1280 1024)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   399
	 bounds: (Rectangle 0 0 475 376)
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   400
       )
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   401
       component:
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   402
      (SpecCollection
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   403
	 collection: (
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   404
	  (LabelSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   405
	     label: 'SearchPattern:'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   406
	     name: 'label'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   407
	     layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   408
	     level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   409
	     translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   410
	     adjust: left
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   411
	   )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   412
	  (ComboBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   413
	     name: 'patternComboBox'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   414
	     layout: (LayoutFrame 2 0.0 26 0 -2 1.0 48 0)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   415
	     activeHelpKey: searchPattern
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   416
	     tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   417
	     model: searchPattern
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   418
	     immediateAccept: false
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   419
	     acceptOnLeave: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   420
	     acceptOnReturn: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   421
	     acceptOnTab: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   422
	     acceptOnLostFocus: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   423
	     acceptOnPointerLeave: false
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   424
	     autoSelectInitialText: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   425
	     comboList: patternList
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   426
	   )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   427
	  (VerticalPanelViewSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   428
	     name: 'VerticalPanel1'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   429
	     layout: (LayoutFrame 0 0.0 52 0 0 1.0 -32 1)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   430
	     horizontalLayout: fit
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   431
	     verticalLayout: top
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   432
	     component:
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   433
	    (SpecCollection
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   434
	       collection: (
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   435
		(CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   436
		   label: 'Case Sensitive'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   437
		   name: 'ignoreCaseCheckBox'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   438
		   activeHelpKey: searchCaseSensitive
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   439
		   level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   440
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   441
		   model: caseSensitive
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   442
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   443
		   extent: (Point 475 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   444
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   445
		(ViewSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   446
		   name: 'MatchBox'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   447
		   component:
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   448
		  (SpecCollection
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   449
		     collection: (
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   450
		      (CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   451
			 label: 'Match (forward only)'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   452
			 name: 'matchCheckBox'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   453
			 layout: (LayoutFrame 0 0 0 0 260 0 0 1)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   454
			 activeHelpKey: matchSearch
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   455
			 level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   456
			 tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   457
			 model: match
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   458
			 translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   459
		       )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   460
		      (CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   461
			 label: 'Regex Match'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   462
			 name: 'CheckBox6'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   463
			 layout: (LayoutFrame -170 1 0 0 0 1 22 0)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   464
			 activeHelpKey: matchWithRegex
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   465
			 enableChannel: matchWithRegexVisible
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   466
			 model: matchWithRegex
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   467
			 translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   468
		       )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   469
		      )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   470
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   471
		   )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   472
		   extent: (Point 475 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   473
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   474
		(CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   475
		   label: 'Search Full Words'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   476
		   name: 'CheckBox2'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   477
		   activeHelpKey: searchFullWord
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   478
		   level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   479
		   enableChannel: searchFullWordEnabled
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   480
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   481
		   model: searchFullWord
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   482
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   483
		   extent: (Point 475 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   484
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   485
		(CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   486
		   label: 'At Begin of Line Only'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   487
		   name: 'CheckBox5'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   488
		   activeHelpKey: searchAtBeginOfLineOnly
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   489
		   level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   490
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   491
		   model: searchAtBeginOfLineOnly
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   492
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   493
		   extent: (Point 475 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   494
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   495
		(CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   496
		   label: 'Variable Only'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   497
		   name: 'CheckBox1'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   498
		   activeHelpKey: searchVariable
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   499
		   level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   500
		   visibilityChannel: searchVariableVisible
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   501
		   enableChannel: searchVariableEnabled
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   502
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   503
		   model: searchVariable
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   504
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   505
		   labelChannel: stringWithVariableUnderCursorHolder
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   506
		   extent: (Point 475 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   507
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   508
		(CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   509
		   label: 'Select Lines'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   510
		   name: 'CheckBox3'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   511
		   activeHelpKey: selectLines
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   512
		   level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   513
		   initiallyInvisible: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   514
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   515
		   model: selectLinesHolder
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   516
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   517
		   extent: (Point 429 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   518
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   519
		(CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   520
		   label: 'Wrap at End of Text (forward only)'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   521
		   name: 'CheckBox7'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   522
		   activeHelpKey: searchWithWrap
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   523
		   level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   524
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   525
		   model: wrapAtEndOfTextHolder
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   526
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   527
		   extent: (Point 475 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   528
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   529
		(ViewSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   530
		   name: 'Box1'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   531
		   extent: (Point 475 10)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   532
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   533
		(HorizontalPanelViewSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   534
		   name: 'HorizontalPanel1'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   535
		   horizontalLayout: leftFit
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   536
		   verticalLayout: fit
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   537
		   ignoreInvisibleComponents: false
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   538
		   elementsChangeSize: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   539
		   component:
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   540
		  (SpecCollection
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   541
		     collection: (
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   542
		      (CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   543
			 label: 'Replace By:'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   544
			 name: 'CheckBox4'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   545
			 activeHelpKey: replaceText
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   546
			 level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   547
			 enableChannel: replaceEnabled
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   548
			 tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   549
			 model: replaceBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   550
			 translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   551
			 resizeForLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   552
			 useDefaultExtent: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   553
		       )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   554
		      (InputFieldSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   555
			 name: 'ReplaceEntryField'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   556
			 activeHelpKey: replaceText
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   557
			 visibilityChannel: replaceBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   558
			 enableChannel: replaceBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   559
			 model: replaceTextHolder
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   560
			 acceptOnReturn: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   561
			 acceptOnTab: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   562
			 acceptOnPointerLeave: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   563
			 extent: (Point 297 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   564
		       )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   565
		      )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   566
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   567
		   )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   568
		   extent: (Point 475 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   569
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   570
		(CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   571
		   label: '  Replace All (to End of Text)'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   572
		   name: 'CheckBox8'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   573
		   activeHelpKey: replaceAll
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   574
		   level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   575
		   enableChannel: replaceBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   576
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   577
		   model: replaceAllBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   578
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   579
		   extent: (Point 475 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   580
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   581
		(CheckBoxSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   582
		   label: '  Preserve Case'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   583
		   name: 'CheckBox9'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   584
		   activeHelpKey: replacePreserveCase
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   585
		   level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   586
		   enableChannel: replaceBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   587
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   588
		   model: replacePreserveCaseBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   589
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   590
		   extent: (Point 475 24)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   591
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   592
		)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   593
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   594
	     )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   595
	   )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   596
	  (HorizontalPanelViewSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   597
	     name: 'horizontalPanelView'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   598
	     layout: (LayoutFrame 0 0.0 -32 1.0 -16 1.0 0 1.0)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   599
	     level: 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   600
	     horizontalLayout: fitSpace
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   601
	     verticalLayout: center
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   602
	     horizontalSpace: 3
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   603
	     verticalSpace: 3
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   604
	     ignoreInvisibleComponents: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   605
	     reverseOrderIfOKAtLeft: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   606
	     component:
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   607
	    (SpecCollection
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   608
	       collection: (
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   609
		(ActionButtonSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   610
		   label: 'Cancel'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   611
		   name: 'cancelButton'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   612
		   level: 2
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   613
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   614
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   615
		   model: cancel
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   616
		   useDefaultExtent: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   617
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   618
		(ActionButtonSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   619
		   label: 'Prev'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   620
		   name: 'prevButton'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   621
		   level: 2
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   622
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   623
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   624
		   model: prevAction
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   625
		   useDefaultExtent: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   626
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   627
		(ActionButtonSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   628
		   label: 'Next'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   629
		   name: 'nextButton'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   630
		   level: 2
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   631
		   borderWidth: 1
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   632
		   translateLabel: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   633
		   tabable: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   634
		   model: nextAction
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   635
		   isDefault: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   636
		   useDefaultExtent: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   637
		 )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   638
		)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   639
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   640
	     )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   641
	     keepSpaceForOSXResizeHandleH: true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   642
	   )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   643
	  )
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   644
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   645
       )
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   646
     )
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   647
! !
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   648
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   649
!TextView class methodsFor:'startup'!
121
claus
parents: 120
diff changeset
   650
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   651
open
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   652
    "start an empty TextView"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   653
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   654
    ^ self openWith:nil
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   655
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   656
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   657
openModalOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   658
    "start a textView on a model; return the 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|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   661
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   662
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   663
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   664
    ^ textView
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
    "Created: 14.2.1997 / 15:24:12 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   667
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   668
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   669
openModalWith:aString
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   670
    "start a textView with aString as initial contents"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   671
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   672
    ^ self openModalWith:aString title:nil
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   673
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   674
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   675
     TextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   676
     EditTextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   677
    "
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
    "Created: 14.2.1997 / 15:19:04 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   680
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   681
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   682
openModalWith:aString title:aTitle
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   683
    "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
   684
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   685
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   686
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   687
    textView := self setupWith:aString title:aTitle.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   688
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   689
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   690
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   691
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   692
     TextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   693
     EditTextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   694
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   695
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   696
    "Modified: 9.9.1996 / 19:32:29 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   697
    "Created: 14.2.1997 / 15:19:18 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   698
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   699
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   700
openOn:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   701
    "start a textView on a file; return the textView"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   702
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   703
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   704
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   705
    textView := self setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   706
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   707
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   708
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   709
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   710
     TextView openOn:'../../doc/overview.doc'
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   711
     EditTextView openOn:'../../doc/overview.doc'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   712
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   713
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   714
    "Modified: 14.2.1997 / 15:21:51 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   715
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   716
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   717
openOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   718
    "start a textView on a model; return the 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|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   721
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   722
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   723
    textView topView open.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   724
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   725
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   726
    "Created: 14.2.1997 / 15:23:36 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   727
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   728
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   729
openWith:aStringOrStringCollection
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   730
    "start a textView with aStringOrStringCollection as initial contents"
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   731
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   732
    ^ self openWith:aStringOrStringCollection selected:false
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   733
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   734
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   735
     TextView openWith:'some text'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   736
     EditTextView openWith:'some text'
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
   737
     Workspace openWith:'some text'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   738
    "
119
claus
parents: 97
diff changeset
   739
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   740
    "Created: 10.12.1995 / 17:41:32 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   741
    "Modified: 5.3.1997 / 15:37:19 / cg"
126
claus
parents: 121
diff changeset
   742
!
claus
parents: 121
diff changeset
   743
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   744
openWith:aStringOrStringCollection selected:selectedBoolean
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   745
    "start a textView with aStringOrStringCollection as initial (optionally selected) contents.
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   746
     Return the 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|
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   749
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   750
    textView := self setupEmpty.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   751
    textView contents:aStringOrStringCollection selected:selectedBoolean.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   752
    textView topView open.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   753
    ^ textView
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   754
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   755
    "
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   756
     TextView openWith:'some text' selected:true
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   757
     EditTextView openWith:'some text' selected:false
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   758
    "
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   759
!
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   760
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   761
openWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   762
    "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
   763
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   764
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   765
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   766
    textView := self setupWith:aStringOrStringCollection title:aTitle.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   767
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   768
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   769
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   770
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   771
     TextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   772
     EditTextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   773
    "
126
claus
parents: 121
diff changeset
   774
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   775
    "Created: 10.12.1995 / 17:40:02 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   776
    "Modified: 5.3.1997 / 15:37:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   777
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   778
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   779
setupEmpty
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   780
    "create a textview in a topview, with horizontal and
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   781
     vertical scrollbars - a helper for #startWith: and #startOn:"
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
    |top frame label|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   784
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   785
    label := 'unnamed'.
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   786
    top := StandardSystemView label:label icon:self defaultIcon.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   787
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   788
    frame := HVScrollableView
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   789
		for:self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   790
		miniScrollerH:true miniScrollerV:false
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   791
		in:top.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   792
    frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   793
    ^ frame scrolledView
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   794
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   795
    "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
   796
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   797
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   798
setupForFile:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   799
    "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
   800
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   801
    |textView|
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   802
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   803
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   804
    aFileName notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   805
	textView setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   806
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   807
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   808
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   809
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
   810
    "Created: / 14-02-1997 / 15:21:43 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
   811
    "Modified: / 25-10-2006 / 14:46:54 / cg"
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   812
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   813
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   814
setupForModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   815
    "setup a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   816
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   817
    |textView|
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   818
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   819
    textView := self setupEmpty.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   820
    textView model:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   821
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   822
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   823
    "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
   824
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   825
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   826
setupWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   827
    "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
   828
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   829
    |top textView|
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   831
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   832
    top := textView topView.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   833
    aTitle notNil ifTrue:[top label:aTitle].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   834
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   835
    aStringOrStringCollection notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   836
	textView contents:aStringOrStringCollection
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   837
    ].
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
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   840
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   841
    "Created: 9.9.1996 / 19:31:22 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   842
    "Modified: 5.3.1997 / 15:37:37 / cg"
119
claus
parents: 97
diff changeset
   843
! !
claus
parents: 97
diff changeset
   844
2744
cb920467a4b4 method category rename
Claus Gittinger <cg@exept.de>
parents: 2740
diff changeset
   845
!TextView methodsFor:'Compatibility-ST80'!
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   846
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   847
displaySelection:aBoolean
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   848
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   849
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   850
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   851
2118
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   852
editText:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   853
    "ST-80 compatibility: set the edited text."
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
    self contents:someText
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
    "Created: / 5.2.2000 / 17:06:18 / cg"
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   858
!
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   859
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   860
selectAndScroll
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   861
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   862
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   863
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   864
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   865
selectFrom:startPos to:endPos
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   866
    "change the selection given two character positions."
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
    self selectFromCharacterPosition:startPos to:endPos
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   869
!
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   870
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   871
selectionStartIndex
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   872
    "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
   873
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   874
    ^ self characterPositionOfSelection
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
    "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
   877
!
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   878
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   879
selectionStopIndex
2052
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   880
    "ST-80 compatibility: return the character position of
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   881
     the character right after the selection."
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   882
2109
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   883
    |idx|
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   884
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   885
    idx := self characterPositionOfSelectionEnd.
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   886
    idx == 0 ifTrue:[^ 0].
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   887
    ^ idx + 1
1584
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
    "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
   890
! !
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   891
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   892
!TextView methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   893
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   894
characterPositionOfSelection
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   895
    "return the character index of the first character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   896
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   897
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   898
    selectionStartLine isNil ifTrue:[^ 0].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   899
    ^ self characterPositionOfLine:selectionStartLine
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   900
			       col:selectionStartCol
1303
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
    "Modified: 14.8.1997 / 16:35:37 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   903
!
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   904
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   905
characterPositionOfSelectionEnd
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   906
    "return the character index of the last character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   907
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   908
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   909
    selectionStartLine isNil ifTrue:[^ 0].
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   910
    ^ self characterPositionOfLine:selectionEndLine
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   911
			       col:selectionEndCol
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   912
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   913
    "Created: 14.8.1997 / 16:35:24 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   914
    "Modified: 14.8.1997 / 16:35:45 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   915
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   916
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   917
contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   918
    "return true, if the contents was saved (by a save action),
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   919
     false if not (or was modified again after the last save)."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   920
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   921
    ^ contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   922
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   923
3214
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   924
contentsWasSaved:aBoolean
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   925
    contentsWasSaved := aBoolean
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   926
!
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   927
3212
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   928
defaultFileNameForFileDialog
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   929
    "return the default fileName to use for the save-box"
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   930
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   931
    ^ defaultFileNameForFileDialog
3212
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   932
!
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   933
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   934
defaultFileNameForFileDialog:aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   935
    "define the default fileName to use for the save-box"
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
    defaultFileNameForFileDialog := aBaseName
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
    "Created: 13.2.1997 / 18:29:53 / cg"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   940
!
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   941
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   942
directoryForFileDialog:aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   943
    "define the default directory to use for save-box"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   944
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   945
    directoryForFileDialog := aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   946
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   947
    "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
   948
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   949
2941
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   950
externalEncoding
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   951
    "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
   952
     This is (currently only) passed down from the fileBrowser,
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   953
     and required when  utf8/japanese/chinese/korean text is edited.
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   954
     (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
   955
     Notice: this only affects the external representation of the text."
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
    ^ externalEncoding
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   958
!
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   959
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   960
externalEncoding:encodingSymOrNil
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   961
    "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
   962
     via the 'save / save as' dialog.
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   963
     This is (currently only) passed down from the fileBrowser,
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   964
     and required when  utf8/japanese/chinese/korean text is edited.
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   965
     (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
   966
     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
   967
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   968
    externalEncoding := encodingSymOrNil
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   969
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   970
2581
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   971
parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   972
    "return the value of the instance variable 'parenthesisSpecification' (automatically generated)"
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   973
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   974
    ^ parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   975
!
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   976
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   977
parenthesisSpecification:aDictionary
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   978
    "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
   979
     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
   980
     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
   981
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   982
    parenthesisSpecification := aDictionary
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   983
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   984
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   985
saveAction:something
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   986
    saveAction := something.
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   987
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   988
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   989
searchBarActionBlock
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   990
    ^ searchBarActionBlock
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   991
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
   992
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   993
searchBarActionBlock:something
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   994
    searchBarActionBlock := something.
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   995
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   996
3787
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   997
!TextView methodsFor:'accessing-behavior'!
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   998
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   999
isReadOnly
5612
513fa58e4761 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1000
    "return true, if the text is readonly."
513fa58e4761 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1001
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  1002
    ^ true
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  1003
!
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  1004
3787
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1005
readOnly:aBoolean
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1006
    "for protocol compatibility with editTextViews,
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1007
     but actually ignored"
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1008
! !
a3654b479897 +dummy readOnly:
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1009
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1010
!TextView methodsFor:'accessing-contents'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1011
2791
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1012
contents:newContents selected:selectedBoolean
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1013
    self contents:newContents.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1014
    selectedBoolean ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1015
	list size == 1 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1016
	    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
  1017
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1018
	    self selectAll
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1019
	]
2791
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
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|
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1024
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1025
     w := Workspace new open.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1026
     w contents:'Hello world' selected:true.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1027
    "
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1028
!
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1029
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1030
fromFile:aFileName
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1031
    "take contents from a named file"
3724
5db1580f82ba mark obsolete message
Stefan Vogel <sv@exept.de>
parents: 3708
diff changeset
  1032
    <resource: #obsolete>
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1033
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1034
    self obsoleteMethodWarning.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1035
    ^ self loadTextFile:aFileName.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1036
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1037
    "Modified: / 25-10-2006 / 14:47:35 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1038
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1039
4755
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1040
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1041
    "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
  1042
     Redefined since changing the contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1043
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1044
    self unselect.
4755
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1045
    super list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1046
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1047
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1048
loadTextFile:aFileName
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1049
    "take contents from a named file"
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|
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1052
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1053
    f := aFileName asFilename.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1054
    self directoryForFileDialog:(f directoryName).
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1055
    self contents:(f contents)
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
    "Created: / 25-10-2006 / 14:44:01 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1058
!
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1059
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1060
setContents:something
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1061
    "set the contents (either a string or a Collection of strings)
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1062
     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
  1063
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1064
    |selStartLine selStartCol selEndLine selEndCol selStyle|
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1065
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1066
    selStartLine := selectionStartLine.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1067
    selStartCol := selectionStartCol.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1068
    selEndLine := selectionEndLine.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1069
    selEndCol := selectionEndCol.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1070
    selStyle := selectStyle.
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
    super setContents:something.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1073
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1074
    selStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1075
	self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1076
	    selectFromLine:selStartLine col:selStartCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1077
	    toLine:selEndLine col:selEndCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1078
	selectStyle := selStyle
1476
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
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
    "Modified: / 31.3.1998 / 23:33:21 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1083
!
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1084
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1085
setList:something
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1086
    "set the displayed contents (a collection of strings)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1087
     without redraw.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1088
     Redefined since changing contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1089
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1090
    self unselect.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1091
    super setList:something
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1092
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1093
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1094
setupForFile:aFileName
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1095
    "take contents from a named file"
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
    |baseName|
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1098
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1099
    self loadTextFile:aFileName.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1100
    aFileName notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1101
	baseName := aFileName asFilename baseName.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1102
	self topView label:baseName.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1103
	self defaultFileNameForFileDialog:baseName.
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1104
    ].
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
    "Created: / 25-10-2006 / 14:47:13 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1107
!
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1108
1487
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1109
text
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1110
    "for ST80 compatibility"
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
    ^ self contents
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
    "Created: / 19.4.1998 / 12:53:10 / cg"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1115
!
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1116
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1117
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
  1118
    "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
  1119
     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
  1120
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1121
    |beginCol endCol endLine thisCharacter flag|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1122
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1123
    flag := #word.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1124
    beginCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1125
    endCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1126
    endLine := selectLine.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1127
    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
  1128
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1129
    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
  1130
    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
  1131
    endCol == 0 ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1132
	endLine := selectLine + 1
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1133
    ].
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1134
1750
d87cc464fde2 comment
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1135
    "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
  1136
    (wordCheck value:thisCharacter) ifTrue:[
5677
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
	 try to catch a blank ...
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1139
	"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1140
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1141
	WordSelectCatchesBlanks ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1142
	    ((beginCol == 1)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1143
	    or:[(self characterAtLine:selectLine col:(beginCol - 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
		((self characterAtLine:selectLine col:(endCol + 1))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1146
		  == Character space) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1147
		    endCol := endCol + 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1148
		    flag := #wordRight
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1149
		]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1150
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1151
		beginCol := beginCol - 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1152
		flag := #wordLeft
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1153
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1154
	].
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1155
    ].
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1156
    aFiveArgBlock value:selectLine
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1157
		  value:beginCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1158
		  value:endLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1159
		  value:endCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1160
		  value:flag
599
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
    "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
  1163
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1164
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1165
!TextView methodsFor:'accessing-look'!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1166
2027
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1167
selectionBackgroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1168
    "return the selection-background color."
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
    ^ selectionBgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1171
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1172
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1173
selectionForegroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1174
    "return the selection-foreground color."
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
    ^ selectionFgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1177
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1178
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1179
selectionForegroundColor:color1 backgroundColor:color2
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1180
    "set both the selection-foreground and cursor background colors.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1181
     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
  1182
     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
  1183
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1184
    selectionFgColor := color1 onDevice:device.
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1185
    selectionBgColor := color2 onDevice:device.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2900
diff changeset
  1186
    self hasSelection ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1187
	self invalidate
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1188
    ]
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1189
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 715
diff changeset
  1190
    "Modified: 29.5.1996 / 16:22:15 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1191
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1192
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1193
!TextView methodsFor:'accessing-mvc'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1194
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1195
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
  1196
    "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
  1197
     and selection. Added for ST-80 compatibility"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1198
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1199
    aspectSym notNil ifTrue:[aspectMsg := aspectSym.
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1200
			     listMsg isNil ifTrue:[listMsg := aspectSym]].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1201
    changeSym notNil ifTrue:[changeMsg := changeSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1202
    listSym notNil ifTrue:[listMsg := listSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1203
    menuSym notNil ifTrue:[menuMsg := menuSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1204
"/    initial notNil ifTrue:[initialSelectionMsg := initial].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1205
    self model:aModel.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1206
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1207
    "Modified: 15.8.1996 / 12:52:54 / stefan"
906
a8b9b481ce70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1208
    "Modified: 2.1.1997 / 16:11:28 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1209
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1210
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1211
!TextView methodsFor:'drag & drop'!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1212
96256221e3af support drag
ca
parents: 2581
diff changeset
  1213
allowDrag:aBoolean
96256221e3af support drag
ca
parents: 2581
diff changeset
  1214
    "enable/disable dragging support
96256221e3af support drag
ca
parents: 2581
diff changeset
  1215
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  1216
    aBoolean ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1217
	dropSource := nil.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1218
    ] ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1219
	dropSource isNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1220
	    dropSource := DropSource
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1221
			    receiver:self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1222
			    argument:nil
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1223
			    dropObjectSelector:#collectionOfDragObjects
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1224
			    displayObjectSelector:nil
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1225
	]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1226
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  1227
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1228
96256221e3af support drag
ca
parents: 2581
diff changeset
  1229
canDrag
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1230
    "returns true if dragging is enabled"
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1231
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1232
    ^ dropSource notNil and:[ self hasSelection ]
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1233
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1234
    "Modified (comment): / 12-02-2012 / 08:37:21 / cg"
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1235
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1236
96256221e3af support drag
ca
parents: 2581
diff changeset
  1237
collectionOfDragObjects
96256221e3af support drag
ca
parents: 2581
diff changeset
  1238
    "returns collection of dragable objects assigned to selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  1239
     Here, by default, a collection of text-dragObjects is generated;
96256221e3af support drag
ca
parents: 2581
diff changeset
  1240
     however, if a dragObjectConverter is defined, that one gets a chance
96256221e3af support drag
ca
parents: 2581
diff changeset
  1241
     to convert as appropriate.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1242
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  1243
    |selection|
96256221e3af support drag
ca
parents: 2581
diff changeset
  1244
96256221e3af support drag
ca
parents: 2581
diff changeset
  1245
    selection := self selection.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1246
96256221e3af support drag
ca
parents: 2581
diff changeset
  1247
    selection size == 0 ifTrue:[^ nil].
5249
cc785134a690 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1248
    ^ Array with:(DropObject newText:selection).
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1249
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1250
96256221e3af support drag
ca
parents: 2581
diff changeset
  1251
dropSource
3245
b17c15b61e94 ugly comments
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  1252
    "returns the dropSource or nil"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1253
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1254
    ^ dropSource
96256221e3af support drag
ca
parents: 2581
diff changeset
  1255
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1256
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1257
dropSource:aDropSourceOrNil
3245
b17c15b61e94 ugly comments
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  1258
    "set the dropSource or nil"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1259
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1260
    dropSource := aDropSourceOrNil.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1261
! !
96256221e3af support drag
ca
parents: 2581
diff changeset
  1262
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1263
!TextView methodsFor:'encoding'!
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1264
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1265
validateFontEncodingFor:newEncoding ask:ask
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1266
    "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
  1267
     which is able to display text encoded as specified by newEncoding"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1268
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1269
    |fontsEncoding msg filter f defaultFont pref matchingFonts
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1270
     matchingFamilyFonts matchingFamilyFaceFonts matchingFamilyFaceStyleFonts
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1271
     matchingFamilyFaceStyleSizeFonts font|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1272
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1273
    font := gc font.
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1274
    fontsEncoding := font encoding.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1275
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1276
    pref := FontDescription preferredFontEncodingFor:newEncoding.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1277
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1278
    (pref match:fontsEncoding) ifTrue:[
5412
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
    ].
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1281
    (fontsEncoding notNil and:[CharacterEncoder isEncoding:pref subSetOf:fontsEncoding]) ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1282
        ^ self
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1283
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1284
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1285
    filter := [:f | |coding|
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1286
                    (coding := f encoding) notNil
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1287
                    and:[pref match:coding]].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1288
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1289
    device flushListOfAvailableFonts.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1290
    matchingFonts := device listOfAvailableFonts select:filter.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1291
    matchingFamilyFonts := matchingFonts select:[:f | f family = font family].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1292
    matchingFamilyFaceFonts := matchingFamilyFonts select:[:f | f face = font face].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1293
    matchingFamilyFaceStyleFonts := matchingFamilyFaceFonts select:[:f | f style = font style].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1294
    matchingFamilyFaceStyleSizeFonts := matchingFamilyFaceStyleFonts select:[:f | f size = font size].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1295
    matchingFamilyFaceStyleSizeFonts size > 0 ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1296
        defaultFont := matchingFamilyFaceStyleSizeFonts first
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1297
    ] ifFalse:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1298
        matchingFamilyFaceStyleFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1299
            defaultFont := matchingFamilyFaceStyleFonts 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
            matchingFamilyFaceFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1302
                defaultFont := matchingFamilyFaceFonts 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
                matchingFamilyFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1305
                    defaultFont := matchingFamilyFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1306
                ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1307
                    matchingFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1308
                        defaultFont := matchingFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1309
                    ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1310
                ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1311
            ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1312
        ].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1313
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1314
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1315
    defaultFont isNil ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1316
        defaultFont isNil ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1317
            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
  1318
            pref := #'iso10646-1'.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1319
        ]
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1320
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1321
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1322
    msg := 'Switch to a %1 encoded font ?'.
3189
945a221e5cb2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3045
diff changeset
  1323
    (ask not or:[self confirm:(resources stringWithCRs:msg with:pref)])
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1324
    ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1325
        self withWaitCursorDo:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1326
            f := FontPanel
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1327
                    fontFromUserInitial:defaultFont
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1328
                    title:(resources string:'Font selection')
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1329
                    filter:filter
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1330
                    encoding:pref.
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
            f notNil ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1333
                self font:f.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1334
            ]
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1335
        ]
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1336
    ]
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
    "Created: 26.10.1996 / 12:06:54 / cg"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1339
    "Modified: 30.6.1997 / 17:46:46 / cg"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1340
! !
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1341
2752
5650a9ab5935 method category rename
Claus Gittinger <cg@exept.de>
parents: 2744
diff changeset
  1342
!TextView methodsFor:'event handling'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1343
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1344
buttonMotion:buttonState x:x y:y
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1345
    "mouse-move while button was pressed - handle selection changes"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1346
3219
e8c7679a8a94 buttonrelease behavior, when released in another view
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
  1347
    (clickLine isNil or:[clickPos isNil]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1348
	dragIsActive := false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1349
	^ self
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1350
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  1351
96256221e3af support drag
ca
parents: 2581
diff changeset
  1352
    dragIsActive ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1353
	(clickPos dist:(x@y)) >= 5.0 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1354
	    dragIsActive := false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1355
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1356
	    self hasSelection ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1357
		dropSource startDragIn:self at:(x@y)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1358
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1359
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1360
	^ self
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1361
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1362
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1363
    "is it the select or 1-button ?"
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1364
    buttonState == 0 ifTrue:[^ self].
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1365
    self sensor leftButtonPressed ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1366
	"/ self setPrimarySelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1367
	"/ self selectionChanged.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1368
	^ self
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1369
    ].
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1370
"/    (device buttonMotionMask:buttonState includesButton:#select) ifFalse:[
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1371
"/        (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
  1372
"/            ^ self
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1373
"/        ].
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1374
"/    ].
53
b587b15eafab *** empty log message ***
claus
parents: 45
diff changeset
  1375
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1376
    "if moved outside of view, start autoscroll"
3202
8217b0acc9f2 select from beginning (in editField
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
  1377
4160
a9c329c2784d changed: buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 4156
diff changeset
  1378
    ((y < 0) and:[firstLineShown ~~ 0]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1379
	self compressMotionEvents:false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1380
	(self startAutoScrollUp:y negated) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1381
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1382
	].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1383
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1384
    (y > height) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1385
	self compressMotionEvents:false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1386
	(self startAutoScrollDown:(y - height)) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1387
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1388
	].
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1389
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  1390
    ((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1391
	self compressMotionEvents:false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1392
	(self startAutoScrollLeft:x) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1393
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1394
	].
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1395
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1396
    (x > width) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1397
	self compressMotionEvents:false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1398
	(self startAutoScrollRight:(x - width)) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1399
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1400
	].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1401
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1402
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1403
    "move inside - stop autoscroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1404
    autoScrollBlock notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1405
	self stopScrollSelect
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1406
    ].
3220
246c5a3bfefa oops - leftover prints
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
  1407
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1408
    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
  1409
4160
a9c329c2784d changed: buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 4156
diff changeset
  1410
    "Modified: / 08-08-2010 / 11:20:54 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1411
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1412
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1413
buttonMultiPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1414
    "multi-mouse-click - select word under pointer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1415
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1416
    (button == 1) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1417
	clickPos := x @ y.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1418
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1419
	"/ 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
  1420
"/        self clearSearchAction.
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  1421
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1422
	clickCount notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1423
	    clickCount := clickCount + 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1424
	    (clickCount == 2) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1425
		self doubleClickX: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 == 3) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1428
		    self tripleClickX:x y:y
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1429
		] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1430
		    (clickCount == 4) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1431
			self quadClickX:x y:y
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1432
		    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1433
		]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1434
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1435
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1436
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1437
	super buttonMultiPress:button x:x y:y
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
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1440
    "Modified: 11.9.1997 / 04:15:35 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1441
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1442
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1443
buttonPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1444
    "mouse-click - prepare for selection change"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1445
1308
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1446
    |sensor clickVisibleLine|
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1447
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1448
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1449
    sensor       := self sensor.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1450
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1451
    (button == 1) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1452
	sensor shiftDown ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1453
	    "mouse-click with shift - adding to selection"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1454
	    self extendSelectionToX:x y:y.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1455
	    ^ self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1456
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1457
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1458
	clickVisibleLine := self visibleLineOfY:y.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1459
	clickPos := x @ y.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1460
	clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1461
	clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1462
	clickStartLine := clickLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1463
	clickStartCol := clickCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1464
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1465
	(self canDrag
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1466
	and:[(self isInSelection:clickLine col:clickCol)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1467
	and:[UserPreferences current startTextDragWithControl not
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1468
	     or:[sensor ctrlDown]]]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1469
	    dragIsActive := true
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1470
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1471
	    self unselect.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1472
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1473
	clickCount := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1474
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1475
	super buttonPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1476
    ]
813
7168eda47e3b Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 770
diff changeset
  1477
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1478
    "Modified: / 20.5.1999 / 17:02:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1479
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1480
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1481
buttonRelease:button x:x y:y
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1482
    "mouse- button release - turn off autoScroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1483
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1484
    (button == 1) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1485
	self hasSelection ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1486
	    self setPrimarySelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1487
	    self selectionChanged.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1488
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1489
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1490
	autoScrollBlock notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1491
	    self stopScrollSelect
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1492
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1493
	dragIsActive ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1494
	    self unselect
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1495
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1496
	clickPos := nil.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1497
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1498
	super buttonRelease:button x:x y:y
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1499
    ].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1500
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1501
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1502
    "/ clickPos := clickLine := clickCol := nil.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1503
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1504
    "Modified: / 20.5.1999 / 17:14:23 / cg"
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1505
!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1506
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1507
doubleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1508
    "double-click - select word under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1509
3588
a70267e5b501 st80 behavior: also scan for matching single quote
Claus Gittinger <cg@exept.de>
parents: 3587
diff changeset
  1510
    |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
  1511
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1512
    self selectWordAtX:x y:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1513
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1514
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1515
     special - if clicked on a parenthesis, select to matching
4702
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1516
     (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
  1517
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1518
    ((sel := self selection) size == 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1519
    and:[(sel := sel at:1) size == 1]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1520
	ch := sel at:1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1521
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1522
	((self isOpeningParenthesis:ch)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1523
	or:[ (self isClosingParenthesis:ch) ]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1524
	    self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1525
		searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1526
		ifFound:[:line :col |
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1527
			      |prevLine prevCol moveBack pos1|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1528
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1529
			      prevLine := firstLineShown.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1530
			      prevCol := viewOrigin x.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1531
			      self selectFromLine:selectionStartLine col:selectionStartCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1532
					   toLine:line col:col.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1533
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1534
			      self sensor ctrlDown ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1535
				  "/ undo scroll operation ...
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1536
				  self withCursor:Cursor eye do:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1537
				      |delayCount|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1538
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1539
				      moveBack := false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1540
				      (self isClosingParenthesis:ch) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1541
					   (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1542
					       moveBack := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1543
					   ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1544
				      ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1545
					   selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1546
					       self makeLineVisible:selectionEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1547
					       moveBack := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1548
					   ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1549
				      ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1550
				      moveBack ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1551
					   delayCount  := 0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1552
					   pos1 := x@y.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1553
					   self invalidateRepairNow:true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1554
					   Delay waitForSeconds:MatchDelayTime.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1555
					   delayCount := delayCount + MatchDelayTime.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1556
					   [self sensor hasUserEventFor:self] whileFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1557
						Delay waitForSeconds:MatchDelayTime / 2.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1558
						delayCount := delayCount + (MatchDelayTime / 2).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1559
						delayCount > 2 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1560
						    self cursor:Cursor eyeClosed.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1561
						].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1562
						delayCount >= 2.3 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1563
						    self cursor:Cursor eye.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1564
						    delayCount := 0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1565
						]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1566
					   ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1567
					   self scrollToLine:prevLine; scrollToCol:prevCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1568
				      ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1569
				  ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1570
			      ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1571
			      ^ self.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1572
			  ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1573
		ifNotFound:[self showNotFound]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1574
		onError:[self beep]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1575
		openingCharacters:((parenthesisSpecification at:#open) ", '([{'")
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1576
		closingCharacters:((parenthesisSpecification at:#close) ", ')]}'").
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1577
	    selectStyle := nil
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1578
	]
4702
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1579
    ].
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1580
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1581
    (self st80SelectMode or:[ self sensor ctrlDown]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1582
	"/ st80 selects:
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1583
	"/   - if clicked right after a parenthesis -> select to matching parenthesis
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1584
	"/   - if clicked right after a quote -> select to matching quote (unless escaped ;-)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1585
	"/   - if clicked at beginning of the line  -> select that line
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1586
	"/   - if clicked at the top of the text    -> select all
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1587
	"/ however, do none of the above, if clicked on a parenthesis
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1588
	clickCol == 1 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1589
	    clickLine == 1 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1590
		self selectAll.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1591
		^ self.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1592
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1593
	    self selectLineAtY:y.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1594
	    selectStyle := #line.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1595
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1596
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1597
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1598
	matchCol := nil.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1599
	"/ see what is to the left of that character ...
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1600
	clickCol > 1 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1601
	    ch := self characterAtLine:clickLine col:clickCol-1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1602
	    (self isOpeningParenthesis:ch) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1603
		matchCol := clickCol - 1
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1604
	    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1605
		('"''|' includes:ch) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1606
		    scanCol := clickCol - 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1607
		    fwdScan := true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1608
		    scanCh := ch.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1609
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1610
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1611
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1612
	fwdSelect := true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1613
	(matchCol isNil and:[scanCol isNil]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1614
	    clickCol < (self listAt:clickLine) size ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1615
		ch := self characterAtLine:clickLine col:clickCol+1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1616
		(self isClosingParenthesis:ch) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1617
		    matchCol := clickCol + 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1618
		    fwdSelect := false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1619
		] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1620
		    ('"''|' includes:ch) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1621
			scanCol := clickCol + 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1622
			fwdScan := false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1623
			scanCh := ch.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1624
		    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1625
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1626
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1627
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1628
	matchCol notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1629
	    self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1630
		searchForMatchingParenthesisFromLine:clickLine col:matchCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1631
		ifFound:[:line :col |
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1632
			  self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1633
				       toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1634
		ifNotFound:[self showNotFound]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1635
		onError:[self beep]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1636
		openingCharacters:((parenthesisSpecification at:#open) , '([{')
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1637
		closingCharacters:((parenthesisSpecification at:#close) , ')]}').
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1638
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1639
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1640
	scanCol notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1641
	    "/ if its an EOL comment, do it differently
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1642
	    ch := self characterAtLine:clickLine col:clickCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1643
	    ch == $/ ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1644
		self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1645
		^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1646
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1647
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1648
	    self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1649
		scanFor:scanCh fromLine:clickLine col:scanCol forward:fwdScan
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1650
		ifFound:[:line :col |
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1651
			    |selStart selEnd|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1652
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1653
			    fwdScan ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1654
				selStart := scanCol+1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1655
				selEnd := col-1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1656
			    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1657
				selStart := scanCol-1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1658
				selEnd := col+1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1659
			    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1660
			    self selectFromLine:clickLine col:selStart
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1661
				 toLine:line col:selEnd.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1662
			    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1663
			   ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1664
		ifNotFound:[self showNotFound].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1665
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1666
	]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1667
    ].
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
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1670
     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
  1671
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1672
    wordStartLine := selectionStartLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1673
    wordEndLine := selectionEndLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1674
    selectStyle == #wordLeft ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1675
	wordStartCol := selectionStartCol + 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1676
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1677
	wordStartCol := selectionStartCol.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1678
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1679
    selectStyle == #wordRight ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1680
	wordEndCol := selectionEndCol - 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1681
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1682
	wordEndCol := selectionEndCol
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1683
    ]
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1684
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  1685
    "Created: / 11-09-1997 / 04:12:55 / cg"
4255
9bf0cc2595a9 changed: #doubleClickX:y:
Claus Gittinger <cg@exept.de>
parents: 4254
diff changeset
  1686
    "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
  1687
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1688
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1689
extendSelectionToX:x y:y
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1690
    "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
  1691
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1692
    self extendSelectionToX:x y:y setPrimarySelection:true
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1693
!
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1694
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1695
extendSelectionToX:x y:y setPrimarySelection:aBoolean
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1696
    "mouse-move while button was pressed - handle selection changes"
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1697
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1698
    |movedVisibleLine movedLine movedCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1699
     movedUp
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1700
     oldStartLine oldEndLine oldStartCol oldEndCol|
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
    movedVisibleLine := self visibleLineOfY:y.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1703
    movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1704
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1705
    (x < leftMargin) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1706
	movedCol := 0
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1707
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1708
	movedCol := self colOfX:x inVisibleLine:movedVisibleLine
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
    y < 0 ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1711
	movedCol := 0
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1712
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1713
    ((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1714
	selectionStartLine notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1715
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1716
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1717
	(clickPos isNil
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1718
	or:[(clickPos x - x) abs < 3
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1719
	    and:[(clickPos y - y) abs < 3]]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1720
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1721
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1722
	selectionStartLine := clickLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1723
	selectionStartCol := clickCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1724
	selectionEndLine := selectionStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1725
	selectionEndCol := selectionStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1726
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1727
	oldStartLine := selectionStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1728
	oldEndLine := selectionEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1729
	oldStartCol := selectionStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1730
	oldEndCol := selectionEndCol-1.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1731
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1732
	selectionStartLine isNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1733
	    selectionStartLine := selectionEndLine := clickLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1734
	    selectionStartCol := selectionEndCol := clickCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1735
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1736
	oldStartLine := selectionStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1737
	oldEndLine := selectionEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1738
	oldStartCol := selectionStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1739
	oldEndCol := selectionEndCol.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1740
    ].
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1741
    oldEndLine isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1742
	oldEndLine := selectionEndLine ? clickLine ? movedLine.
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1743
    ].
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1744
    oldEndCol isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1745
	oldEndCol := selectionEndCol ? clickCol.
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1746
    ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1747
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1748
    "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
  1749
    movedUp := false.
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1750
    clickStartLine isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1751
	clickStartLine := movedLine.
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1752
    ].
3505
cdb364dede3e extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
  1753
    clickStartCol isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1754
	clickStartCol := movedCol.
3505
cdb364dede3e extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
  1755
    ].
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1756
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1757
    (movedLine < clickStartLine) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1758
	movedUp := true
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1759
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1760
	(movedLine == clickStartLine) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1761
	    (movedCol < clickStartCol) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1762
		movedUp := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1763
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1764
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1765
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1766
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1767
    movedUp ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1768
	"change selectionStart"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1769
	selectionStartCol := movedCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1770
	selectionStartLine := movedLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1771
	selectionEndCol := clickStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1772
	selectionEndLine := clickStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1773
	selectStyle notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1774
	    selectionEndCol := wordEndCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1775
	    selectionEndLine := wordEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1776
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1777
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1778
	"change selectionEnd"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1779
	selectionEndCol := movedCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1780
	selectionEndLine := movedLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1781
	selectionStartCol := clickStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1782
	selectionStartLine := clickStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1783
	selectStyle notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1784
	    selectionStartCol := wordStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1785
	    selectionStartLine := wordStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1786
	]
3251
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
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1789
    selectionStartLine isNil ifTrue:[^ self].
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
    (selectionStartCol == 0) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1792
	selectionStartCol := 1
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1793
    ].
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
    "
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1796
     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
  1797
    "
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1798
    (selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1799
	movedUp ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1800
	    selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1801
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1802
	    selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1803
	    selectionEndCol == 0 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1804
		selectionEndLine := selectionEndLine + 1
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1805
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1806
	].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1807
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1808
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1809
    selectStyle == #line ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1810
	movedUp ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1811
	    selectionStartCol := 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1812
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1813
	    selectionEndCol := 0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1814
	    selectionEndLine := selectionEndLine + 1
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1815
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1816
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1817
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1818
    self validateNewSelection.
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1819
    aBoolean ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1820
	self setPrimarySelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1821
	self selectionChanged.
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1822
    ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1823
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  1824
    "/ 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
  1825
"/    self clearSearchAction.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1826
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1827
    (oldStartLine == selectionStartLine) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1828
	(oldStartCol ~~ selectionStartCol) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1829
	    self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1830
		redrawLine:oldStartLine
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1831
		      from:((selectionStartCol min:oldStartCol) max:1)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1832
			to:((selectionStartCol max:oldStartCol) max:1)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1833
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1834
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1835
	self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1836
	    redrawFromLine:(oldStartLine?selectionStartLine min:selectionStartLine)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1837
			to:(oldStartLine?selectionStartLine max:selectionStartLine)
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1838
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1839
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1840
    (oldEndLine == selectionEndLine) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1841
	(oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1842
	    self redrawLine:oldEndLine
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1843
		       from:((selectionEndCol min:oldEndCol) max:1)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1844
			 to:((selectionEndCol max:oldEndCol) max:1)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1845
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1846
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1847
	selectionEndLine isNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1848
	    selectionStartLine := nil.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1849
	    self redraw.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1850
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1851
	    (selectionStartLine notNil) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1852
		self redrawFromLine:(oldEndLine min:selectionEndLine)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1853
				 to:(oldEndLine max:selectionEndLine)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1854
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1855
	]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1856
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1857
    clickLine := movedLine.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1858
    clickCol := movedCol
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1859
4234
65f202270d2c changed: #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 4178
diff changeset
  1860
    "Modified: / 05-04-2011 / 17:13:35 / cg"
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  1861
    "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
  1862
!
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1863
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1864
keyPress:key x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1865
    "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
  1866
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1867
    <resource: #keyboard (#Find #Copy #FindNext #FindPrev #FindAgain
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1868
			  #GotoLine #SelectAll #SaveAs #Print
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1869
			  #'F*' #'f*' #ZoomIn #ZoomOut)>
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1870
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1871
    (key == #Find) ifTrue:[self search. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1872
    (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
  1873
    (key == #GotoLine) ifTrue:[self gotoLine. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1874
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1875
    (key == #FindNext) ifTrue:[self searchFwd. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1876
    (key == #FindPrev) ifTrue:[self searchBwd. ^self].
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1877
    (key == #FindAgain) ifTrue:[self searchAgainInSameDirection. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1878
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1879
    (key == #SelectAll) ifTrue:[self selectAll. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1880
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1881
    (key == #SaveAs)    ifTrue:[self save.    ^self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1882
    (key == #Print)     ifTrue:[self doPrint. ^self].
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  1883
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1884
    (key == #ZoomIn or:[key == #ZoomOut]) ifTrue:[ self fontLargerOrSmaller:(key == #ZoomIn) ].
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1885
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1886
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1887
     shift-Fn defines a key-sequence
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1888
     Fn       pastes that sequence
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1889
     cmd-Fn   performs a 'doIt' on the sequence (Workspaces only)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1890
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1891
     (see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1892
    "
1193
811135bbd017 Do not crash when typing simple keys.
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
  1893
    (key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1894
	(('[fF][0-9]' match:key)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1895
	or:['[fF][0-9][0-9]' match:key]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1896
	    self sensor shiftDown ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1897
		UserPreferences current functionKeySequences
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1898
		    at:key put:(self selection)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1899
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1900
	    ^ self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1901
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1902
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1903
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1904
    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
  1905
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1906
    "Modified: / 18-04-1997 / 12:12:27 / stefan"
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  1907
    "Modified: / 10-03-2012 / 09:40:01 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1908
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1909
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1910
mapped
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1911
    super mapped.
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1912
    selectionFgColor := selectionFgColor onDevice:device.
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1913
    selectionBgColor := selectionBgColor onDevice:device.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1914
!
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
quadClickX:x y:y
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1917
    "quadrupleClick-click - select all"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1918
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1919
    self selectAll
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1920
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1921
    "Created: / 11.9.1997 / 04:15:24 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1922
    "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
  1923
!
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
tripleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1926
    "triple-click - select line under pointer"
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
    self selectLineAtY:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1929
    selectStyle := #line
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1930
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1931
    "Created: 11.9.1997 / 04:13:37 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1932
! !
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1933
2120
1054ce5c8fe7 category change
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
  1934
!TextView methodsFor:'initialization & release'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1935
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1936
fetchDeviceResources
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1937
    "fetch device colors, to avoid reallocation at redraw time"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1938
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1939
    super fetchDeviceResources.
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1940
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1941
    selectionFgColor notNil ifTrue:[selectionFgColor := selectionFgColor onDevice:device].
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1942
    selectionBgColor notNil ifTrue:[selectionBgColor := selectionBgColor onDevice:device].
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1943
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1944
    "Created: 14.1.1997 / 00:14:33 / cg"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1945
!
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1946
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1947
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1948
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1949
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1950
    super initStyle.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1951
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1952
    viewBackground := DefaultViewBackground.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1953
    selectionFgColor := DefaultSelectionForegroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1954
    selectionFgColor isNil ifTrue:[selectionFgColor := bgColor].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1955
    selectionBgColor := DefaultSelectionBackgroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1956
    selectionBgColor isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1957
	device hasColors ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1958
	    DefaultSelectionForegroundColor isNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1959
		selectionFgColor := fgColor
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1960
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1961
	    selectionBgColor := Color green
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1962
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1963
	    device hasGrayscales ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1964
		DefaultSelectionForegroundColor isNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1965
		    selectionFgColor := fgColor
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1966
		].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1967
		selectionBgColor := Color gray
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1968
	    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1969
		selectionBgColor := fgColor
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1970
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1971
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1972
    ].
708
e8eb52699f90 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  1973
4321
4c8c94f6e1c6 comemnt in: #initStyle
az
parents: 4310
diff changeset
  1974
    "Modified: / 22-01-1997 / 11:57:53 / cg"
4c8c94f6e1c6 comemnt in: #initStyle
az
parents: 4310
diff changeset
  1975
    "Modified (comment): / 05-10-2011 / 15:50:45 / az"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1976
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1977
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1978
initialize
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1979
    super initialize.
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1980
    self initializeSaveAction.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1981
    contentsWasSaved := false.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1982
    dragIsActive     := false.
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  1983
    lastSearchWasMatch := lastSearchWasVariableSearch := false.
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  1984
    lastSearchIgnoredCase := true.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1985
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1986
    parenthesisSpecification isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1987
	parenthesisSpecification := DefaultParenthesisSpecification.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1988
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1989
911
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1990
    "I handle menus myself"
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1991
    menuHolder := menuPerformer := self.
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1992
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1993
    "/ on default allow drag
96256221e3af support drag
ca
parents: 2581
diff changeset
  1994
    self allowDrag:true.
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1995
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1996
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1997
initializeSaveAction
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1998
    saveAction := [ self openSaveDialog ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1999
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2000
4450
ef24b9b60ec1 category of:21 methods
Claus Gittinger <cg@exept.de>
parents: 4437
diff changeset
  2001
!TextView methodsFor:'menu & menu actions'!
248
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
appendTo:aFileName
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2004
    "append contents to a file named fileName"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2005
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2006
    |aStream msg filename|
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2007
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2008
    filename := aFileName asFilename.
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2009
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2010
    (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2011
	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
  2012
	self warn:(msg , '\\(ST/X internal permission check)' ) withCRs.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2013
	^ self
2036
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  2014
    ].
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  2015
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2016
    [
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2017
	aStream := filename appendingWriteStream.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2018
	[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2019
	    self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2020
	] ensure:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2021
	    aStream close.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2022
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2023
	contentsWasSaved := true
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2024
    ] on:FileStream openErrorSignal do:[:ex|
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2025
	msg := resources string:'cannot append to file %1 !!' with:filename name.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2026
	self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2027
    ]
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2028
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2029
    "Modified: / 27-07-2012 / 09:41:18 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2030
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2031
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2032
changeFont
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2033
    "pop up a fontPanel to change font"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2034
5676
20a8f1c87323 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5675
diff changeset
  2035
    |newFont fp userPrefs fontPrefs newFontPrefs|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2036
5005
2acadbbf1bce class: TextView
Claus Gittinger <cg@exept.de>
parents: 5004
diff changeset
  2037
    self withWaitCursorDo:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2038
	fp := FontPanel new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2039
	fp withChangeFontInViewsAllCheckBox:true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2040
	newFont := fp fontFromUserInitial:gc font.
5005
2acadbbf1bce class: TextView
Claus Gittinger <cg@exept.de>
parents: 5004
diff changeset
  2041
    ].
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2042
    newFont notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2043
	self font:newFont.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2044
	fp changeFontInAllViews ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2045
	    "/ user checked this box - change the defaults,
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2046
	    "/ and update all other textviews now.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2047
	    userPrefs := UserPreferences current.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2048
	    fontPrefs := userPrefs fontPreferences.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2049
	    fontPrefs isNil ifTrue:[ fontPrefs := newFontPrefs := Dictionary new ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2050
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2051
	    TextView defaultFont:newFont.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2052
	    fontPrefs at:#Text put:(newFont storeString).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2053
	    newFontPrefs notNil ifTrue:[ userPrefs fontPreferences:newFontPrefs ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2054
	    userPrefs beModified.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2055
	    DebugView newDebugger.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2056
	    TextView allSubInstances do:[:v |
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2057
		v font:newFont
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2058
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2059
	].
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2060
    ]
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2061
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2062
    "Modified: 27.2.1996 / 00:53:51 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2063
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2064
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2065
copySelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2066
    "copy contents into smalltalk copybuffer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2067
863
ed4282df00a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
  2068
    |text|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2069
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2070
    text := self selection.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2071
    text notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2072
	self unselect.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2073
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2074
	"/ forget any emphasis ...
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2075
	text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2076
	self setClipboardText:text.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2077
    ]
649
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  2078
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  2079
    "Modified: 17.5.1996 / 08:57:54 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2080
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2081
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2082
defaultForGotoLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2083
    "return a default value to show in the gotoLine box"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2084
447
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2085
    ^ selectionStartLine
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2086
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2087
    "Modified: 1.3.1996 / 18:44:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2088
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2089
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2090
doPrint
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2091
    "print the contents on the printer"
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2092
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2093
    |printStream|
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2094
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2095
    list isNil ifTrue:[^ self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2096
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2097
    self withWaitCursorDo:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2098
	printStream := Printer new.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2099
	printStream supportsContext ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2100
	    printStream printerContext font:(self font).
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2101
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2102
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2103
	Printer writeErrorSignal handle:[:ex |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2104
	    self warn:('error while printing:\\'
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2105
			, ex description
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2106
			, '\\(printing with: ' , (Printer printCommand) , ')') withCRs
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2107
	] do:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2108
	    self fileOutContentsOn:printStream.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2109
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2110
	printStream close
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2111
    ].
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2112
4363
4ed2feefc2c2 changed: #doPrint
Claus Gittinger <cg@exept.de>
parents: 4361
diff changeset
  2113
    "Created: / 06-05-1996 / 16:11:26 / cg"
4ed2feefc2c2 changed: #doPrint
Claus Gittinger <cg@exept.de>
parents: 4361
diff changeset
  2114
    "Modified: / 31-01-2012 / 18:16:39 / cg"
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2115
!
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2116
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2117
editMenu
1109
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  2118
    "return my popUpMenu"
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  2119
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  2120
    <resource: #keyboard (#Copy #Find #GotoLine #SaveAs #Print)>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  2121
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  2122
1545
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2123
    |items m|
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2124
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2125
    items := #(
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2126
			('Copy'          copySelection  Copy)
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
			('Search...'     search         Find)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2129
			('Goto Line...'  gotoLine       GotoLine)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2130
			('-'             nil            )
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2131
			('Font...'       changeFont     )
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2132
			('-'             nil            )
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2133
			('Save As...'    save           SaveAs)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2134
			('Print'         doPrint        Print)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2135
		).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2136
1545
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2137
    m := PopUpMenu itemList:items resources:resources.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2138
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2139
    self hasSelectionForCopy ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2140
	m disable:#copySelection.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2141
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2142
    ^ m
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  2143
2458
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  2144
    "Modified: / 12.11.2001 / 13:43:56 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2145
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2146
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2147
find
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2148
    "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
  2149
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2150
    self search
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2151
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2152
    "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
  2153
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2154
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2155
fontLargerOrSmaller:largerBoolean
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2156
    |oldFont newFont|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2157
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2158
    oldFont := gc font.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2159
    newFont := oldFont asSize:(largerBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2160
                            ifTrue:[oldFont size + 1]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2161
                            ifFalse:[(oldFont size-1) max:4]).
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2162
    self font:newFont.
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2163
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2164
    "Modified: / 27-02-1996 / 00:53:51 / cg"
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2165
    "Created: / 10-03-2012 / 09:38:32 / cg"
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2166
!
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2167
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2168
gotoLine
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2169
    "show a box to enter lineNumber for positioning;
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2170
     The entered number may be prefixed by a + or -;
1926
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  2171
     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
  2172
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  2173
    |l lineNumberBox input lineToGo relative|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2174
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2175
    lineNumberBox :=
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2176
	EnterBox
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2177
	   title:(resources string:'Line number (or +/- relativeNr):')
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2178
	   okText:(resources string:'Goto')
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2179
	   abortText:(resources string:'Cancel')
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2180
	   action:[:l | input := l].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2181
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2182
    l := self defaultForGotoLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2183
    l notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2184
	l := l printString
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2185
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2186
    lineNumberBox initialText:l .
3394
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
  2187
    lineNumberBox label:(resources string:'Goto Line').
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2188
    lineNumberBox showAtPointer.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2189
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2190
    input size > 0 ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2191
	input := input withoutSpaces.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2192
	input size > 0 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2193
	    (input startsWith:$+) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2194
		relative := 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2195
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2196
		(input startsWith:$-) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2197
		    relative := -1.
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
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2200
	    relative notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2201
		input := input copyFrom:2.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2202
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2203
	    lineToGo := Integer readFromString:input onError:nil.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2204
	    lineToGo notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2205
		relative notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2206
		    lineToGo := self currentLine + (lineToGo * relative)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2207
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2208
		self gotoLine:lineToGo
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2209
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2210
	]
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2211
    ].
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2212
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2213
    "Modified: / 17.5.1998 / 20:07:59 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2214
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2215
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2216
openSaveDialog
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2217
    "Ask user for filename using a fileSelectionBox
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2218
     and save contents into that file."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2219
2695
7e13db2802df better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
  2220
    Dialog
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2221
	requestSaveFileName:(resources string:'Save contents in:')
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2222
	default:defaultFileNameForFileDialog
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2223
	fromDirectory:directoryForFileDialog
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2224
	action:[:fileName | self saveAs:fileName]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2225
	appendAction:[:fileName | self appendTo:fileName]
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2226
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2227
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2228
openSearchBoxAndSearch
5736
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2229
    "search for a string - show a box to enter searchpattern.
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2230
     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
  2231
     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
  2232
     would no be appropriate..."
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2233
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2234
    "
4985
414cb5cbe48f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4885
diff changeset
  2235
     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
  2236
     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
  2237
    "
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2238
    |searchBox patternHolder caseHolder matchHolder matchWithRegexHolder wrapAtEndHolder
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2239
     fwd ign match initialString
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2240
     bindings bldr doSearch modal searchVariableHolder selectedVariable searchFullWordHolder selectLinesHolder
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2241
     replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2242
     replaceAllBooleanHolder replacePreserveCaseBooleanHolder
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2243
     searchAtBeginOfLineOnlyHolder updateReturnKeyBehavior|
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2244
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2245
    searchBarActionBlock notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2246
	self resetVariablesBeforeNewSearch.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2247
	searchBarActionBlock value:#search value:self.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2248
	^ self
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2249
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2250
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2251
    modal := (UserPreferences current searchDialogIsModal).   "/ that's experimental
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2252
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2253
    (searchBox := self objectAttributeAt:#currentModelessSearchBox) notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2254
	(modal not
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2255
	and:[ searchBox window realized ]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2256
	    "/ reuse it.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2257
	    searchBox window
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2258
		raiseDeiconified;
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2259
		requestFocus;
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2260
		assignKeyboardFocusToFirstKeyboardConsumer.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2261
	    ^ self.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2262
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2263
	searchBox closeRequest.
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2264
    ].
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2265
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2266
    ign := lastSearchIgnoredCase "? LastSearchIgnoredCase " ? true.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2267
    caseHolder := ign not asValue.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2268
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2269
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2270
    matchHolder := match asValue.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2271
    matchWithRegexHolder := (LastSearchWasMatchWithRegex ? false) asValue.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2272
    wrapAtEndHolder := (LastSearchWasWrapAtEndOfText ? false) asValue.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2273
    searchVariableHolder := (lastSearchWasVariableSearch ? false) asValue.
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2274
    searchFullWordHolder := false asValue.
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2275
    searchAtBeginOfLineOnlyHolder := false asValue.
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2276
    selectLinesHolder := false asValue.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2277
    replaceBooleanHolder := ("LastSearchWasReplace ?" false) asValue.
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2278
    replaceAllBooleanHolder := false asValue.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2279
    replacePreserveCaseBooleanHolder := false asValue.
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2280
    replaceTextHolder := (LastSearchReplacedString ? '') asValue.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2281
    replaceBooleanEnabledHolder := self isReadOnly not asValue.
4399
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
    patternHolder := '' asValue.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2284
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2285
    self setSearchPatternWithMatchEscapes: match.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2286
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2287
    lastSearchPattern notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2288
	initialString := lastSearchPattern.
4399
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
"/  No longer force the current selection to be the initialString
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2291
"/    self hasSelectionWithinSingleLine ifTrue:[
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2292
"/        initialString := self selection asString.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2293
"/    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2294
    initialString isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2295
	LastSearchPatterns size > 0 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2296
	    initialString := LastSearchPatterns first.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2297
	]
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
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2300
    initialString notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2301
	patternHolder value:initialString.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2302
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2303
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2304
    fwd := true.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2305
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2306
    doSearch := [:fwd |
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2307
	|isVariableSearch pattern searchAction|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2308
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2309
	self resetVariablesBeforeNewSearch.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2310
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2311
	isVariableSearch := self searchVariableVisible
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2312
				and:[searchVariableHolder value
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2313
				and:[selectedVariable notNil]].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2314
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2315
	isVariableSearch ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2316
	    searchAction :=
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2317
		[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2318
		    self searchVariableWithSyntaxElement:selectedVariable forward:fwd
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2319
		].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2320
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2321
	    lastSearchWasVariableSearch := false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2322
	    LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2323
	    LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2324
	    LastSearchWasMatchWithRegex := matchWithRegexHolder value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2325
	    LastSearchWasWrapAtEndOfText := wrapAtEndHolder value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2326
	    LastSearchWasReplace :=replaceBooleanHolder value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2327
	    LastSearchReplacedString := replaceTextHolder value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2328
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2329
	    pattern := patternHolder value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2330
	    pattern notEmptyOrNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2331
		searchAction :=
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2332
		    [
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2333
			self searchUsingSpec:(
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2334
			    self class searchSpec new
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2335
				pattern:pattern
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2336
				ignoreCase:lastSearchIgnoredCase
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2337
				match: lastSearchWasMatch
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2338
				regexMatch:matchWithRegexHolder value
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2339
				variable: searchVariableHolder value
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2340
				fullWord: searchFullWordHolder value
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2341
				forward:fwd
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2342
				atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2343
				wrapAtEnd:wrapAtEndHolder value).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2344
		    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2345
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2346
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2347
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2348
	replaceBooleanHolder value ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2349
	    |selStart replacement replaceAction|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2350
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2351
	    replacement := replaceTextHolder value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2352
	    isVariableSearch ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2353
		"/ must replace from the end towards beginning,
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2354
		"/ because syntax-elements do not update their position, when
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2355
		"/ the text is changed (in replace).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2356
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2357
		selectedVariable := selectedVariable lastElementInChain.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2358
		self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2359
		searchAction :=
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2360
		    [
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2361
			selectedVariable := selectedVariable previousElement.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2362
			selectedVariable notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2363
			    self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2364
			].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2365
			"/ self searchVariableWithSyntaxElement:selectedVariable forward:false
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2366
		    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2367
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2368
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2369
	    replaceAction := [ self replace:replacement ]. "/ not implemented here, but in subclasses
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2370
	    replacePreserveCaseBooleanHolder value ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2371
		replaceAction := [
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2372
		    self selectionAsString isUppercaseFirst ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2373
			self replace:replacement asUppercaseFirst
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2374
		    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2375
			self replace:replacement asLowercaseFirst
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2376
		    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2377
		].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2378
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2379
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2380
	    selStart := self characterPositionOfSelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2381
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2382
	    replaceAction value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2383
	    searchAction value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2384
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2385
	    replaceAllBooleanHolder value ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2386
		[self characterPositionOfSelection ~= selStart] whileTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2387
		    selStart := self characterPositionOfSelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2388
		    replaceAction value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2389
		    searchAction value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2390
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2391
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2392
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2393
	    searchAction value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2394
	].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2395
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2396
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2397
    bindings := IdentityDictionary new.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2398
    bindings at:#searchPattern put:patternHolder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2399
    modal ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2400
	bindings
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2401
	    at:#nextAction
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2402
	    put:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2403
		replaceAllBooleanHolder value ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2404
		    searchBox doAccept.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2405
		] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2406
		    doSearch value:true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2407
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2408
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2409
	bindings
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2410
	    at:#prevAction
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2411
	    put:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2412
		replaceAllBooleanHolder value ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2413
		    fwd := false. searchBox doAccept.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2414
		] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2415
		    doSearch value:false
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2416
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2417
	    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2418
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2419
	bindings at:#nextAction put:[doSearch value:true.].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2420
	bindings at:#prevAction put:[doSearch value:false.].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2421
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2422
    bindings at:#caseSensitive put:caseHolder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2423
    bindings at:#match put:matchHolder.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2424
    bindings at:#matchWithRegex put:matchWithRegexHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2425
    Regex::RxMatcher isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2426
	bindings at:#matchWithRegexVisible put:false.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2427
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2428
	bindings at:#matchWithRegexVisible put:matchHolder
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2429
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2430
    bindings at:#patternList put:LastSearchPatterns.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2431
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2432
    self supportsSyntaxElements ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2433
	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
  2434
    ] ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2435
	bindings at:#searchVariableVisible put:true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2436
	selectedVariable := self syntaxElementForSelectedVariable.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2437
	bindings at:#searchVariableEnabled put:(selectedVariable notNil).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2438
	selectedVariable notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2439
	    bindings
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2440
		at:#stringWithVariableUnderCursorHolder
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2441
		put:(resources string:'Variable ("%1")' with:selectedVariable name).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2442
	    "/ searchVariableHolder value:true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2443
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2444
	    bindings
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2445
		at:#stringWithVariableUnderCursorHolder
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2446
		put:(resources string:'Variable (none selected)').
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2447
	].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2448
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2449
    bindings at:#searchVariable put:searchVariableHolder.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2450
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2451
    bindings at:#searchFullWord put:searchFullWordHolder.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2452
    bindings at:#searchFullWordEnabled put:true.
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2453
    bindings at:#searchAtBeginOfLineOnly put:searchAtBeginOfLineOnlyHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2454
    bindings at:#wrapAtEndOfTextHolder put:wrapAtEndHolder.
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2455
    bindings at:#selectLinesHolder put:selectLinesHolder.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2456
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2457
    bindings at:#replaceEnabled put:replaceBooleanEnabledHolder.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2458
    bindings at:#replaceBoolean put:replaceBooleanHolder.
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2459
    bindings at:#replaceAllBoolean put:replaceAllBooleanHolder.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2460
    bindings at:#replacePreserveCaseBoolean put:replacePreserveCaseBooleanHolder.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2461
    bindings at:#replaceTextHolder put:replaceTextHolder.
5555
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
    bindings at:#flyByHelpSpec put:self class flyByHelpSpec.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2464
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2465
    updateReturnKeyBehavior :=
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2466
	[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2467
	    |lbl returnAction|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2468
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2469
	    "/ when replacing, do not close box on return
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2470
	    replaceBooleanHolder value ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2471
		lbl := 'Close'.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2472
		returnAction := searchAction.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2473
	    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2474
		lbl := 'Cancel'.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2475
		returnAction := nil.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2476
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2477
	    (bldr componentAt:#cancelButton) label:(resources string:lbl).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2478
	    searchBox window keyboardProcessor returnAction:returnAction.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2479
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2480
5010
ad4a10879e16 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5005
diff changeset
  2481
    replaceBooleanHolder onChangeEvaluate:
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2482
	[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2483
	    replaceBooleanHolder value ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2484
		(bldr componentAt:#ReplaceEntryField) requestFocus
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2485
	    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2486
		(bldr componentAt:#patternComboBox) requestFocus
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2487
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2488
	    updateReturnKeyBehavior value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2489
	].
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2490
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2491
    modal ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2492
	searchBox := SimpleDialog new.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2493
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2494
	searchBox := ApplicationModel new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2495
	searchBox createBuilder.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2496
	bindings at:#cancel put:[ searchBox closeRequest ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2497
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2498
    searchBox resources:(self resources).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2499
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2500
    bldr := searchBox builder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2501
    bldr addBindings:bindings.
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2502
    bldr aspectAt:#flyByHelpSpec put:(self class flyByHelpSpec).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2503
    searchBox allButOpenFrom:(self class searchDialogSpec).
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
    (bldr componentAt:#nextButton) cursor:(Cursor thumbsUp).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2506
    (bldr componentAt:#prevButton) cursor:(Cursor thumbsUp).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2507
    (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2508
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2509
    modal ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2510
	updateReturnKeyBehavior value.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2511
	searchBox openDialogAtPointer.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2512
	searchBox accepted ifTrue:[ doSearch value:fwd ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2513
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2514
	(bldr componentAt:#nextButton) isReturnButton:false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2515
	(bldr componentAt:#cancelButton)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2516
		label:(resources string:'Close');
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2517
		action:[searchBox closeRequest].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2518
	"/ searchBox masterApplication:self application.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2519
	self topView beMaster.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2520
	searchBox window
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2521
		beSlave;
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2522
		openInGroup:(self windowGroup);
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2523
		waitUntilVisible;
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2524
		assignKeyboardFocusToFirstKeyboardConsumer.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2525
	searchBox window keyboardProcessor
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2526
	    addAccelerator:#Return action:(bindings at:#nextAction);
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2527
	    addAccelerator:#Escape action:#closeRequest.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2528
	"/ remember this box for me.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2529
	self objectAttributeAt:#currentModelessSearchBox put:searchBox.
4399
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
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2532
    "Modified: / 11-07-2006 / 11:18:38 / fm"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2533
    "Created: / 08-03-2012 / 14:02:59 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2534
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2535
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2536
replace:someText
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2537
    "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
  2538
     Subclasses may redefine me."
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2539
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2540
    ^ self.
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2541
!
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2542
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2543
save
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2544
    "save contents into a file
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2545
     - ask user for filename using a fileSelectionBox."
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2546
3201
ce84e272c6bb code cleanup
Claus Gittinger <cg@exept.de>
parents: 3189
diff changeset
  2547
    saveAction value
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2548
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2549
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2550
saveAs:fileName
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2551
    "save the contents into a file named fileName.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2552
     On error return false otherwise return true"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2553
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2554
    ^ self saveAs:fileName doAppend:false
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2555
!
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2556
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2557
saveAs:aFilename doAppend:doAppend
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2558
    "save the contents into a file named fileName;
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2559
     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
  2560
     contents - otherwise, it overwrites any previous file contents.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2561
     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
  2562
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2563
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:true
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2564
!
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2565
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2566
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2567
    "save the contents into a file named fileName;
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2568
     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
  2569
     contents - otherwise, it overwrites any previous file contents.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2570
     On error return false otherwise return true"
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2571
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2572
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:nil
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2573
!
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2574
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2575
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:eolMode
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2576
    "save the contents into a file named fileName;
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2577
     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
  2578
     contents - otherwise, it overwrites any previous file contents.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2579
     eolMode is one of #cr, #nl or #crlf.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2580
     On error return false otherwise return true."
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2581
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2582
    |filename msg|
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2583
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2584
    filename := aFilename asFilename.
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2585
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2586
    self withWriteCursorDo:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2587
	|aStream|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2588
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2589
	(FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2590
	    msg := resources
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2591
			stringWithCRs:'Refused to write file ''%1'' !!\(ST/X internal permission check)'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2592
			with:filename name.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2593
	] ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2594
	    [
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2595
		doAppend ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2596
		    aStream := filename appendingWriteStream.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2597
		] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2598
		    UserPreferences current generateBackupFileWhenSaving ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2599
			filename exists ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2600
			    filename moveTo:(filename pathName,'.bak') asFilename
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2601
			].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2602
		    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2603
		    aStream := filename newReadWriteStream.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2604
		].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2605
		aStream eolMode:eolMode.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2606
		self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2607
		aStream syncData; close.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2608
		contentsWasSaved := true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2609
		defaultFileNameForFileDialog := filename.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2610
	    ] on:FileStream openErrorSignal do:[:ex|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2611
		msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2612
				with:filename name
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2613
				with:FileStream lastErrorString.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2614
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2615
	].
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2616
    ].
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2617
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2618
    msg notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2619
	Dialog warn:msg.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2620
	^ false
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2621
    ].
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2622
    ^ true
916
4201c9c2a4f0 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  2623
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2624
    "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
  2625
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2626
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2627
search
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2628
    "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
  2629
     - 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
  2630
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2631
    self openSearchBoxAndSearch
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2632
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2633
    "Modified: / 11-07-2006 / 11:18:38 / fm"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2634
    "Modified: / 08-03-2012 / 14:03:10 / cg"
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2635
!
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2636
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2637
search:patternArg ignoreCase:ign forward:fwd
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2638
    "search for a string without matching"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2639
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2640
    self search:patternArg ignoreCase:ign match: false forward:fwd
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2641
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2642
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2643
search:patternArg ignoreCase:ign match: match forward:fwd
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2644
    |pattern|
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2645
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2646
    pattern := patternArg string.
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2647
    pattern notEmpty ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2648
	self rememberSearchPattern:pattern.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2649
	"/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2650
	"/ LastSearchWasMatch := match.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2651
	fwd ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2652
	    lastSearchDirection := #backward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2653
	    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
  2654
	] ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2655
	    lastSearchDirection := #forward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2656
	    self searchFwd:pattern ignoreCase:ign match: match.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2657
	]
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2658
    ]
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2659
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2660
    "Created: / 11-07-2006 / 11:18:04 / fm"
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  2661
    "Modified: / 23-03-2012 / 12:12:07 / cg"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2662
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2663
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2664
searchUsingSpec:aSearchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2665
    self rememberSearchPattern:(aSearchSpec pattern).
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2666
    "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2667
    "/ LastSearchWasMatch := match.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2668
    aSearchSpec forward ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2669
	lastSearchDirection := #backward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2670
	self searchBwdUsingSpec:aSearchSpec
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2671
    ] ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2672
	lastSearchDirection := #forward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2673
	self searchFwdUsingSpec:aSearchSpec
4462
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
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2676
    "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
  2677
    "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
  2678
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2679
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2680
searchVariableVisible
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2681
    "search variable option in searchbox visible?
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2682
     (only true for codeview2's textview)"
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
    ^ false
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2685
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2686
    "Created: / 08-03-2012 / 14:01:24 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2687
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2688
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2689
searchVariableWithSyntaxElement:syntaxElementForVariable forward:fwd
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2690
    "this only works for CodeView2::TextView, which supports syntaxElements.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2691
     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
  2692
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2693
    |el el2|
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2694
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2695
    lastSearchWasVariableSearch := true.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2696
    el := fwd
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2697
	ifTrue:[syntaxElementForVariable nextElement]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2698
	ifFalse:[syntaxElementForVariable previousElement].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2699
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2700
    el notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2701
	"bug workaround"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2702
	(el start = syntaxElementForVariable start) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2703
	    el2 := fwd
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2704
		ifTrue:[el nextElement]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2705
		ifFalse:[el previousElement].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2706
	    el2 notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2707
		el := el2
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2708
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2709
	].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2710
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2711
    el notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2712
	self selectFromCharacterPosition:el start to:el stop.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2713
	self makeLineVisible:(self lineOfCharacterPosition:el start).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2714
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2715
	self showNotFound
4399
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
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2718
    "Created: / 08-03-2012 / 14:08:20 / cg"
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
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2721
syntaxElementForSelectedVariable
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2722
    "for a better search; ignored here, but redefined in CodeView2"
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
    ^ nil
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2725
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2726
    "Created: / 08-03-2012 / 14:20:27 / cg"
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
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2729
syntaxElementForVariableUnderCursor
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2730
    "for a better search; ignored here, but redefined in CodeView2"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2731
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2732
    ^ nil
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2733
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2734
    "Created: / 08-03-2012 / 12:45:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2735
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2736
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2737
!TextView methodsFor:'native widget support'!
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2738
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2739
nativeWindowType
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2740
    "return a symbol describing my native window type
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2741
     (may be used internally by the device as a native window creation hint,
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2742
      if the device supports native windows)"
5120
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
    ^ #TextView
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2745
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2746
    "Created: 2.5.1997 / 14:41:00 / cg"
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2747
! !
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2748
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2749
!TextView methodsFor:'private'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2750
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2751
currentSelectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2752
    ^  selectionBgColor
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
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2755
currentSelectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2756
    ^ selectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2757
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2758
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2759
fileOutContentsOn:aStream
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2760
    "save contents on a stream, replacing leading spaces by tab-characters."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2761
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2762
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2763
	fileOutContentsOn:aStream
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2764
	compressTabs:true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2765
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2766
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2767
fileOutContentsOn:aStream compressTabs:compressTabs
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2768
    "save contents on a stream. If compressTabs is true,
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2769
     leading spaces will be replaced by tab-characters in the output."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2770
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2771
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2772
	fileOutContentsOn:aStream
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2773
	compressTabs:compressTabs
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2774
	encoding:nil
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2775
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2776
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2777
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
  2778
    "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
  2779
     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
  2780
2877
cdaea8ccd364 encoding
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  2781
    |startNr nLines string encoder|
cdaea8ccd364 encoding
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  2782
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2783
    self removeTrailingWhitespace.
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2784
5658
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  2785
    "/ This is now obsolete, as we are always using unicode internally.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  2786
    "/ so the following line should be changed to encoderToEncodeFrom:unicode to:xxx.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2787
    encoder := CharacterEncoder encoderToEncodeFrom:gc characterEncoding into:encodingSymOrNil.
4455
febe97112d50 changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  2788
    encoder isNullEncoder ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2789
	(list contains:[:lineOrNil|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2790
			    |s|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2791
			    lineOrNil notNil
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2792
			    and:[(s := lineOrNil string string) isWideString
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2793
			    and:[s asSingleByteStringIfPossible isWideString]]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2794
		       ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2795
	) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2796
	    (Dialog confirm:'The text contains non-8bit characters. Encode as UTF8?') ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2797
		^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2798
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2799
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2800
	encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8
4455
febe97112d50 changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  2801
    ].
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  2802
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2803
    aStream isFileStream ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2804
	"on some systems, writing linewise is very slow (via NFS)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2805
	 therefore we convert to a string and write it in big chunks.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2806
	 To avoid creating huge strings, we do it in blocks of 1000 lines,
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2807
	 limiting temporary string creation to about 50-80k.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2808
	"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2809
	startNr := 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2810
	nLines := list size.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2811
	(aStream eolMode notNil
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2812
	and:[aStream eolMode ~= #nl]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2813
	    "/ must do it lineWise ...
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2814
	    list do:[:line |
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2815
		line notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2816
		    encoder encodeString:line withTabs on:aStream
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2817
		].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2818
		aStream cr
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2819
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2820
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2821
	    [startNr <= nLines] whileTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2822
		string := list
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2823
			    asStringWithCRsFrom:startNr
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2824
			    to:((startNr + 1000) min:nLines)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2825
			    compressTabs:compressTabs.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2826
		encoder encodeString:string string on:aStream.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2827
		startNr := startNr + 1000 + 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2828
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2829
	].
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2830
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2831
	list do:[:aLine |
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2832
	    aLine notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2833
		encoder encodeString:aLine on:aStream.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2834
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2835
	    aStream cr.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2836
	]
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2837
    ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2838
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2839
    "Modified: 8.6.1996 / 11:50:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2840
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2841
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2842
getFontParameters
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2843
    "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
  2844
     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
  2845
     line separation. This is required, to allow for proper handling of
4779
9f7633fc5583 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4767
diff changeset
  2846
     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
  2847
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2848
    |italicFont boldFont font|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2849
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2850
    font := gc createFontOnDevice.
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2851
    "/ do we really need this info now?
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2852
    "/ on unix, it seems to work with the next two lines commented;
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2853
    "/ should probably check on windows too
3258
0a07b6fdd85d fix: must care for the case where the italic font is higher than
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
  2854
    italicFont := font asItalic onDevice:device.
3304
bd0991615b04 When computing font parameters, now consider the bold font, too.
Stefan Vogel <sv@exept.de>
parents: 3298
diff changeset
  2855
    boldFont := font asBold onDevice:device.
3258
0a07b6fdd85d fix: must care for the case where the italic font is higher than
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
  2856
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2857
    fontHeight := font height.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2858
    fontAscent := font ascent.
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2859
    fontWidth := font width.
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2860
    fontIsFixedWidth := font isFixedWidth.
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2861
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2862
    "/ fA := font maxAscent.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2863
    italicFont notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2864
	fontHeight := fontHeight max:(italicFont height).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2865
	fontAscent := fontAscent max:(italicFont ascent).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2866
	fontIsFixedWidth := fontIsFixedWidth and:[ italicFont isFixedWidth ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2867
    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2868
    boldFont notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2869
	fontHeight := fontHeight max:(boldFont height).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2870
	fontAscent := fontAscent max:(boldFont ascent).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2871
	fontIsFixedWidth := fontIsFixedWidth and:[ boldFont isFixedWidth ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2872
    ].
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  2873
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2874
    includesNonStrings == true ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2875
	"/ for now, we do not support variable height entries ...
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2876
	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
  2877
    ].
4579
3a5a72358a0a class: TextView
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
  2878
    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
  2879
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2880
    "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
  2881
    "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
  2882
!
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  2883
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2884
highlightLineSpacing
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2885
    "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
  2886
     false if it remains white.
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2887
     false for selection in list views; true for edit/text views"
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2888
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2889
    ^ true
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2890
!
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  2891
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2892
isClosingParenthesis:ch
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2893
    ((parenthesisSpecification at:#close) includes:ch) ifTrue:[^ true].
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2894
    ^ ')]}' includes:ch
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2895
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2896
    "Modified: / 12-02-2012 / 08:37:01 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2897
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2898
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2899
isOpeningParenthesis:ch
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2900
    ((parenthesisSpecification at:#open) includes:ch) ifTrue:[^ true].
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2901
    ^ '([{' includes:ch
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2902
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  2903
    "Modified: / 12-02-2012 / 08:37:11 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2904
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  2905
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2906
rememberSearchPattern:pattern
2691
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  2907
    |nRemembered patternString|
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  2908
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2909
    self clearSearchAction.
2813
ec8e83691849 forget searchAction, when a new pattern-search is done
Claus Gittinger <cg@exept.de>
parents: 2811
diff changeset
  2910
2691
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  2911
    patternString := pattern string.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2912
3270
e3ed37e15f9d oops - last-searchpatterns handling removed the wrong one.
Claus Gittinger <cg@exept.de>
parents: 3258
diff changeset
  2913
    nRemembered := NumRememberedSearchPatterns ? 20.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2914
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2915
    LastSearchPatterns isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2916
	LastSearchPatterns := OrderedCollection new.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2917
    ].
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2918
    "/ move to top or addFirst
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2919
    (LastSearchPatterns includes:patternString) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2920
	LastSearchPatterns remove:patternString.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2921
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2922
	LastSearchPatterns size > nRemembered ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2923
	    LastSearchPatterns removeLast
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2924
	]
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2925
    ].
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2926
    LastSearchPatterns addFirst:patternString.
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2927
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2928
    "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
  2929
!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2930
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2931
removeTrailingWhitespace
3001
d9877eeb59f5 *** empty log message ***
ca
parents: 2992
diff changeset
  2932
    list isNil ifTrue:[^self].
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2933
    list keysAndValuesDo:[:lineNR :line |
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2934
	|l|
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2935
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2936
	line notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2937
	    l := line withoutTrailingSeparators.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2938
	    list at:lineNR put:l.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2939
	]
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2940
    ].
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2941
!
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2942
4009
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2943
resetVariablesBeforeNewSearch
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2944
    "clear the autosearch action, when the first pattern is searched for"
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2945
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2946
    searchAction := nil.
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2947
!
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  2948
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2949
scrollSelectDown
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2950
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2951
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2952
    |prevEndLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2953
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2954
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2955
    selectionEndLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2956
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2957
    self scrollDown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2958
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2959
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2960
    prevEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2961
    selectionEndLine := firstLineShown + nFullLinesShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2962
    selectionEndCol := 0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2963
    prevEndLine to:selectionEndLine do:[:lineNr |
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2964
	self redrawLine:lineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2965
    ].
5235
888c50995301 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5120
diff changeset
  2966
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  2967
    self selectionChanged.
248
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2970
scrollSelectLeft
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2971
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2972
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2973
    |prevStartLine|
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
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2976
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2977
    selectionStartCol isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2978
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2979
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2980
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2981
    selectionStartCol := selectionStartCol - 1 max:1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2982
    self scrollLeft.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2983
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  2984
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  2985
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2986
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2987
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2988
scrollSelectRight
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2989
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2990
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2991
    |prevEndCol firstVisibleCol endLine|
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
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2994
    selectionEndCol isNil ifTrue:[^ self].
4169
11d3b7a3e713 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4160
diff changeset
  2995
    selectionEndLine isNil ifTrue:[^ self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2996
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2997
    prevEndCol := selectionEndCol.
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2998
    selectionEndCol := (selectionEndCol + 1) min:(self listAt:selectionEndLine) size.
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  2999
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3000
    endLine := self listLineToVisibleLine:selectionEndLine.
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3001
    endLine notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3002
	firstVisibleCol := self colOfX:1 inVisibleLine:endLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3003
	selectionEndCol < firstVisibleCol ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3004
	    "/ scrolling faster than selection advances...
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3005
	    selectionEndCol := firstVisibleCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3006
	].
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3007
    ].
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3008
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3009
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3010
    self scrollRight.
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3011
    "/ self repairDamage.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3012
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3013
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3014
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3015
    "Modified: / 05-08-2010 / 21:25:56 / cg"
248
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3018
scrollSelectUp
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3019
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3020
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3021
    |prevStartLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3022
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3023
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3024
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3025
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3026
    self scrollUp.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3027
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3028
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3029
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3030
    selectionStartLine := firstLineShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3031
    selectionStartCol := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3032
    selectionStartLine to:prevStartLine do:[:lineNr |
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3033
	self redrawLine:lineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3034
    ].
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3035
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  3036
    self selectionChanged.
248
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3039
stopScrollSelect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3040
    "stop auto scroll; deinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3041
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3042
    autoScrollBlock notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3043
	Processor removeTimedBlock:autoScrollBlock.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3044
	self compressMotionEvents:true.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3045
	autoScrollBlock := nil.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3046
	autoScrollDeltaT := nil
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3047
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3048
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3049
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3050
textChanged
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3051
    self isNativeWidget ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3052
	gc drawableId notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3053
	    device changeText:self contents in:gc drawableId
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3054
	]
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3055
    ].
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3056
    super textChanged
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3057
!
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3058
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3059
widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3060
    "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
  3061
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3062
    selectionStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3063
	"/ if there is a selection which covers multiple lines,
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3064
	"/ 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
  3065
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3066
	(lastLine < selectionStartLine) ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3067
	    (firstLine > selectionEndLine) ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3068
		^ width
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3069
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3070
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3071
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3072
    ^ super widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3073
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3074
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3075
!TextView methodsFor:'queries'!
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3076
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3077
hasSearchActionSelection
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3078
    "Here we fake the use of typeOfSelection which is really in EditTextView"
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3079
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3080
    ^ false
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3081
!
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3082
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3083
specClass
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  3084
    "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
  3085
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3086
    self class == TextView ifTrue:[^ TextEditorSpec].
1046
10da5b6bd390 specClass query
ca
parents: 1028
diff changeset
  3087
    ^ super specClass
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3088
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  3089
    "Modified: / 31.10.1997 / 19:48:35 / cg"
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3090
! !
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3091
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3092
!TextView methodsFor:'redrawing'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3093
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3094
clearMarginOfVisibleLine:visLine with:color
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3095
    "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
  3096
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3097
    (leftMargin ~~ 0) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3098
	viewOrigin x <= margin ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3099
	    self paint:color.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3100
	    self fillRectangleX:margin-viewOrigin x
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3101
			      y:(self yOfVisibleLine:visLine)- (lineSpacing//2)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3102
			  width:leftMargin
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3103
			 height:fontHeight
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3104
	]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3105
    ]
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3106
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3107
    "Created: 6.3.1996 / 14:22:55 / cg"
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3108
!
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3109
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3110
drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3111
    startVisLineNr to:endVisLineNr do:[:visLine |
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3112
	self drawVisibleLineSelected:visLine
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3113
    ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3114
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3115
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3116
drawVisibleLineSelected:visLineNr
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3117
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3118
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3119
	inVisible:visLineNr
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3120
	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
  3121
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3122
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3123
drawVisibleLineSelected:visLineNr col:col
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3124
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3125
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3126
	inVisible:visLineNr
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3127
	col:col
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3128
	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
  3129
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3130
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3131
drawVisibleLineSelected:visLineNr from:selectionStartCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3132
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3133
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3134
	inVisible:visLineNr
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3135
	from:selectionStartCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3136
	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
  3137
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3138
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3139
drawVisibleLineSelected:visLineNr from:startCol to:endCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3140
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3141
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3142
	inVisible:visLineNr
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3143
	from:startCol to:endCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3144
	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
  3145
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3146
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3147
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3148
    "redraw a visible line range"
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
    |startLine endLine specialCare end selVisStart line1 line2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3151
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3152
    shown ifFalse:[^ self].
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
    end := endVisLineNr.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3155
    (end > nLinesShown) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3156
	end := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3157
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3158
2740
892dfb6b0da1 kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  3159
    selectionEndLine isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3160
	selectionStartLine := nil
2740
892dfb6b0da1 kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  3161
    ].
2735
5ba2010aefa4 *** empty log message ***
penk
parents: 2730
diff changeset
  3162
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3163
    selectionStartLine isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3164
	specialCare := false
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3165
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3166
	startLine := self visibleLineToAbsoluteLine:startVisLineNr.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3167
	(startLine > selectionEndLine) 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
	    endLine := self visibleLineToAbsoluteLine:end.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3171
	    (endLine < selectionStartLine) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3172
		specialCare := false
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3173
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3174
		specialCare := true
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3175
	    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3176
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3177
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3178
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3179
    "easy: nothing is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3180
    specialCare ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3181
	super redrawFromVisibleLine:startVisLineNr to:end.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3182
	^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3183
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3184
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3185
    "easy: all is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3186
    ((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3187
	self drawSelectedFromVisibleLine:startVisLineNr to:end.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3188
	^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3189
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3190
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3191
    (selectionStartLine >= firstLineShown) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3192
	"draw unselected top part"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3193
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3194
	selVisStart := self listLineToVisibleLine:selectionStartLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3195
	super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1).
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3196
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3197
	"and first partial selected line"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3198
	self redrawVisibleLine:selVisStart.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3199
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3200
	"rest starts after this one"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3201
	line1 := selVisStart + 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3202
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3203
	line1 := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3204
    ].
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
    (line1 > end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3207
    (line1 < startVisLineNr) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3208
	line1 := startVisLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3209
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3210
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3211
    "draw middle part of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3212
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3213
    (selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3214
	line2 := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3215
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3216
	line2 := (self listLineToVisibleLine:selectionEndLine) - 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3217
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3218
    (line2 > end) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3219
	line2 := end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3220
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3221
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3222
    self drawSelectedFromVisibleLine:line1 to:line2.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3223
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3224
    (line2 >= end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3225
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3226
    "last line of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3227
    self redrawVisibleLine:(line2 + 1).
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
    ((line2 + 2) <= end) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3230
	super redrawFromVisibleLine:(line2 + 2) to:end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3231
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3232
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3233
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3234
redrawVisibleLine:visLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3235
    "redraw visible line lineNr"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3236
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3237
    |line|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3238
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3239
    (selectionStartLine notNil and:[selectionEndLine notNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3240
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3241
	line := self visibleLineToAbsoluteLine:visLineNr.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3242
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3243
	    (line == selectionStartLine) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3244
		(line == selectionEndLine) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3245
		    "it's part-of-single-line selection"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3246
		    self clearMarginOfVisibleLine:visLineNr with:bgColor.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3247
		    (selectionStartCol > 1) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3248
			super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3249
		    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3250
		    self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3251
		    super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3252
		    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3253
		].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3254
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3255
		"it's the first line of a multi-line selection"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3256
		(selectionStartCol ~~ 1) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3257
		    self clearMarginOfVisibleLine:visLineNr with:bgColor.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3258
		    super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3259
		] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3260
		    viewOrigin x == 0 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3261
			self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3262
		    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3263
		].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3264
		self drawVisibleLineSelected:visLineNr from:selectionStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3265
		^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3266
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3267
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3268
	    (line == selectionEndLine) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3269
		"it's the last line of a multi-line selection"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3270
		(selectionEndCol == 0) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3271
		    ^ super redrawVisibleLine:visLineNr
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3272
		].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3273
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3274
		self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3275
		self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3276
		super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3277
		^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3278
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3279
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3280
	    "it's a full line in a multi-line selection"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3281
	    self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3282
	    self drawVisibleLineSelected:visLineNr.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3283
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3284
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3285
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3286
    super redrawVisibleLine:visLineNr
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3287
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3288
    "Modified: 6.3.1996 / 14:22:19 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3289
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3290
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3291
redrawVisibleLine:visLine col:col
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3292
    "redraw single character at col in visible line lineNr."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3293
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3294
    |line|
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3295
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3296
    "/
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3297
    "/ care for selection
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3298
    "/
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3299
    (selectionStartLine notNil and:[selectionEndLine notNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3300
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3301
	line := self visibleLineToAbsoluteLine:visLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3302
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3303
	    ((line == selectionStartLine)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3304
	    and: [col < selectionStartCol]) ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3305
		((line == selectionEndLine)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3306
		and: [col > selectionEndCol]) ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3307
		    "its in the selection"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3308
		    self drawVisibleLineSelected:visLine col:col.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3309
		    ^ self.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3310
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3311
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3312
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3313
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3314
    self drawVisibleLine:visLine col:col with:fgColor and:bgColor
1496
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3315
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3316
    "Modified: / 22.4.1998 / 08:53:05 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3317
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3318
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3319
redrawVisibleLine:visLine from:startCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3320
    "redraw visible line lineNr from startCol to end of line"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3321
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3322
    |col line|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3323
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3324
    col := startCol.
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3325
    col == 0 ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3326
	col := 1.
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3327
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3328
2778
223915a2d6a4 kludge workaround selectionEndLine is sometimes nil
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  3329
    (selectionStartLine notNil and:[selectionEndLine notNil]) ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3330
	line := self visibleLineToAbsoluteLine:visLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3331
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3332
	    ((line == selectionStartLine)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3333
	     or:[line == selectionEndLine]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3334
		"since I'm lazy, redraw full line"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3335
		self redrawVisibleLine:visLine.
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
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3338
	    "the line is fully within the selection"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3339
	    self drawVisibleLineSelected:visLine from:col.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3340
	    ^ self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3341
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3342
    ].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3343
    super redrawVisibleLine:visLine from:col
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3344
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3345
    "Modified: 6.3.1996 / 14:19:38 / cg"
248
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3348
redrawVisibleLine:visLine from:startCol to:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3349
    "redraw visible line lineNr from startCol to endCol"
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
    |line allOut allIn leftCol rightCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3352
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3353
    line := self visibleLineToAbsoluteLine:visLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3354
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3355
    allIn := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3356
    allOut := false.
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3357
    (selectionStartLine isNil or:[selectionEndLine isNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3358
    or:[selectionStartCol isNil or:[selectionEndCol isNil]]]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3359
	allOut := true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3360
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3361
	(line between:selectionStartLine and:selectionEndLine) ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3362
	    allOut := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3363
	] ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3364
	    (selectionStartLine == selectionEndLine) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3365
		((endCol < selectionStartCol)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3366
		or:[startCol > selectionEndCol]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3367
		    allOut := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3368
		] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3369
		    ((startCol >= selectionStartCol)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3370
		    and:[endCol <= selectionEndCol]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3371
			allIn := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3372
		    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3373
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3374
	    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3375
		(line == selectionStartLine) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3376
		    (endCol < selectionStartCol) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3377
			allOut := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3378
		    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3379
			(startCol >= selectionStartCol) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3380
			    allIn := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3381
			]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3382
		    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3383
		] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3384
		    (line == selectionEndLine) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3385
			(startCol > selectionEndCol) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3386
			    allOut := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3387
			] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3388
			    (endCol <= selectionEndCol) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3389
				allIn := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3390
			    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3391
			]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3392
		    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3393
			allIn := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3394
		    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3395
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3396
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3397
	]
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
    allOut ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3400
	super redrawVisibleLine:visLine from:startCol to:endCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3401
	^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3402
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3403
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3404
    allIn ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3405
	self drawVisibleLineSelected:visLine from:startCol to:endCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3406
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3407
	"redraw part before selection"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3408
	((line == selectionStartLine)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3409
	 and:[startCol <= selectionStartCol]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3410
	    super redrawVisibleLine:visLine from:startCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3411
					      to:(selectionStartCol - 1).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3412
	    leftCol := selectionStartCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3413
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3414
	    leftCol := startCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3415
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3416
	"redraw selected part"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3417
	(selectionEndLine > line) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3418
	    rightCol := endCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3419
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3420
	    rightCol := selectionEndCol min:endCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3421
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3422
	self drawVisibleLineSelected:visLine from:leftCol to:rightCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3423
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3424
	"redraw part after selection"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3425
	(rightCol < endCol) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3426
	    super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3427
	]
248
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3430
    "special care for first and last line of selection:
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3431
     must handle margin also"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3432
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3433
    ((line == selectionEndLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3434
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3435
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3436
    ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3437
	self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3438
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3439
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3440
    ((line == selectionStartLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3441
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3442
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3443
    ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3444
	self clearMarginOfVisibleLine:visLine with:bgColor.
4602
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3445
    ].
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3446
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3447
    ((line > selectionStartLine)
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3448
    and:[(startCol == 1)
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3449
    and:[selectionStartLine < selectionEndLine
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3450
    and:[line < selectionEndLine]]])
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3451
    ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3452
	self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3453
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3454
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3455
    "Modified: 6.3.1996 / 14:23:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3456
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3457
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3458
!TextView methodsFor:'searching'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3459
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3460
clearSearchAction
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3461
    searchAction := nil.
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3462
!
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3463
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3464
scanFor:aCharacter fromLine:startLine col:startCol forward:forward
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3465
		     ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3466
		  ifNotFound:notFoundBlock
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3467
    "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
  3468
     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
  3469
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3470
    |lineString
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3471
     line   "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3472
     col    "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3473
     delta  "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3474
     endCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3475
     cc
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3476
     maxLine "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3477
      |
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3478
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3479
    col := startCol.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3480
    line := startLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3481
    forward ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3482
	delta := 1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3483
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3484
	delta := -1.
1322
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
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3487
    lineString := list at:line.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3488
    maxLine := list size.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3489
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3490
    col := col + delta.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3491
    [true] whileTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3492
	lineString notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3493
	    forward ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3494
		endCol := lineString size.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3495
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3496
		endCol := 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3497
	    ].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3498
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3499
	    col to:endCol by:delta do:[:rCol |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3500
		cc := lineString at:rCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3501
		cc == aCharacter ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3502
		    ^ foundBlock value:line value:rCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3503
		]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3504
	    ].
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
	line := line + delta.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3507
	(line < 1 or:[line > maxLine]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3508
	    ^ notFoundBlock value
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3509
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3510
	lineString := list at:line.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3511
	forward ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3512
	    col := 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3513
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3514
	    col := lineString size
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3515
	]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3516
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3517
    "not reached"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3518
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3519
    "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
  3520
    "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
  3521
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3522
3802
sr
parents: 3792
diff changeset
  3523
searchAction
sr
parents: 3792
diff changeset
  3524
    ^ searchAction
sr
parents: 3792
diff changeset
  3525
!
sr
parents: 3792
diff changeset
  3526
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3527
searchAction:aSearcherOrSearchBlock
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3528
    searchAction := aSearcherOrSearchBlock
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3529
!
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3530
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3531
searchAgainInSameDirection
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3532
    "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
  3533
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3534
    |ign match|
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3535
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  3536
    searchBarActionBlock notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3537
	searchBarActionBlock value:#forward value:self.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3538
	^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3539
    ].
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3540
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3541
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3542
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3543
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3544
    self setSearchPatternWithMatchEscapes: match.
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3545
    lastSearchPattern notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3546
	lastSearchDirection == #backward ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3547
	    self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3548
		searchBwd:lastSearchPattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3549
		ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3550
		match: match
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3551
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3552
	    self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3553
		searchFwd:lastSearchPattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3554
		ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3555
		match: match
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3556
	]
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
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3559
    "Created: / 03-05-1999 / 15:02:16 / cg"
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3560
    "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
  3561
!
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3562
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3563
searchBwd
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3564
    "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
  3565
     If found, position cursor"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3566
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3567
    |ign selectedVariable|
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  3568
2811
3a7aed97fd76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  3569
    searchAction notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3570
	"/autosearch is cleared whenever there is search with user selection
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3571
	(self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
4178
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3572
    ].
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3573
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3574
    searchAction notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3575
	"/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
  3576
	self searchUsingSearchAction:#backward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3577
	^ self.
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3578
    ].
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  3579
    searchBarActionBlock notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3580
	searchBarActionBlock value:#backward value:self.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3581
	^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3582
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3583
    lastSearchWasVariableSearch ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3584
	selectedVariable := self syntaxElementForSelectedVariable.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3585
	selectedVariable notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3586
	    self searchVariableWithSyntaxElement:selectedVariable forward:false.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3587
	    ^ self.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3588
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3589
	lastSearchWasVariableSearch := false.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3590
    ].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3591
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3592
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  3593
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3594
    self setSearchPatternWithMatchEscapes: false.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3595
    lastSearchPattern isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3596
	LastSearchPatterns size > 0 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3597
	    lastSearchPattern := LastSearchPatterns first
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3598
	]
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3599
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3600
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3601
    lastSearchPattern notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3602
	lastSearchDirection := #backward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3603
	self rememberSearchPattern:lastSearchPattern.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3604
	self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3605
	    searchBwd:lastSearchPattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3606
	    ignoreCase:ign
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3607
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3608
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3609
    "Modified: / 08-03-2012 / 14:26:25 / cg"
248
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3612
searchBwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3613
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3614
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3615
    self searchBwd:pattern ifAbsent:[self showNotFound].
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3616
"/    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3617
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3618
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3619
    "Modified: / 21-09-2006 / 16:48:29 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3620
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3621
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3622
searchBwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3623
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3624
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3625
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3626
	searchBwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3627
					pattern:pattern)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3628
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3629
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3630
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3631
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3632
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3633
searchBwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3634
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3635
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3636
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3637
	searchBwd:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3638
	ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3639
	ifAbsent:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3640
		    self sensor compressKeyPressEventsWithKey:#FindPrev.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3641
		    self showNotFound
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3642
		 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3643
    "/ lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3644
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3645
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3646
    "Created: / 13-09-1997 / 06:18:00 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3647
    "Modified: / 23-03-2012 / 12:10:25 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3648
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3649
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3650
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3651
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3652
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3653
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3654
	searchBwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3655
					pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3656
					ignoreCase:ign)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3657
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3658
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3659
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3660
    "Created: 13.9.1997 / 06:18:41 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3661
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3662
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3663
searchBwd:pattern ignoreCase:ign match: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3664
    "do a backward search.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3665
    match pattern functionality is not yet available for backward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3666
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3667
    "/ lastSearchWasMatch := match.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3668
    self searchBwd:pattern ignoreCase:ign.
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3669
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3670
    "Modified: / 23-03-2012 / 12:12:44 / cg"
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3671
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3672
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3673
searchBwdUsingSpec:searchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3674
    "do a backward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3675
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3676
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3677
	searchBwdUsingSpec:searchSpec
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3678
	ifAbsent:[self showNotFound].
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3679
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3680
"/    lastSearchIgnoredCase := false.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3681
    lastSearchPattern := searchSpec pattern string
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3682
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3683
    "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
  3684
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3685
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3686
searchBwdUsingSpec:searchSpec ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3687
    "do a backward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3688
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3689
    |pos startLine startCol|
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3690
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3691
    pos :=  self startPositionForSearchBackward.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3692
    startLine := pos y.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3693
    startCol := pos x.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3694
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3695
    self
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3696
	searchBackwardUsingSpec:searchSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3697
	startingAtLine:startLine col:startCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3698
	ifFound:[:line :col :endColOrNil|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3699
	    self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3700
	]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3701
	ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3702
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3703
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3704
searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3705
    "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
  3706
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3707
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3708
	searchForMatchingParenthesisFromLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3709
	ifFound:[:line :col |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3710
		  self selectFromLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3711
			       toLine:line col:col]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3712
	ifNotFound:[self showNotFound]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3713
	onError:[self beep]
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3714
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3715
    "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
  3716
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3717
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3718
searchForMatchingParenthesisFromLine:startLine col:startCol
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3719
		     ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3720
		  ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3721
		     onError:failBlock
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3722
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3723
    "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
  3724
     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
  3725
     backwards if its a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3726
     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
  3727
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3728
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3729
    ^ self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3730
	searchForMatchingParenthesisFromLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3731
	ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3732
	ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3733
	onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3734
	ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' )
3478
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3735
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3736
    "Modified: / 12-04-2007 / 11:24:24 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3737
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3738
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3739
searchForMatchingParenthesisFromLine:startLine col:startCol
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3740
		     ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3741
		  ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3742
		     onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3743
		    ignoring:ignoreSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3744
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3745
    "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
  3746
     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
  3747
     backwards if its a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3748
     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
  3749
     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
  3750
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3751
    ^ self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3752
	searchForMatchingParenthesisFromLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3753
	ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3754
	ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3755
	onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3756
	openingCharacters: (parenthesisSpecification at:#open)  "/ #( $( $[ ${ "$> $<")
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3757
	closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<")
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3758
	ignoredCharacters: ignoreSet
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3759
	specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3760
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3761
"/    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3762
"/     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3763
"/     ignoring
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3764
"/     line   "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3765
"/     col    "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3766
"/     delta  "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3767
"/     endCol "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3768
"/     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3769
"/     cc prevCC nextCC incSet decSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3770
"/     nesting "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3771
"/     maxLine "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3772
"/     ign skip anySet|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3773
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3774
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3775
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3776
"/    parChar := self characterAtLine:startLine col:startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3777
"/    i := charSet indexOf:parChar.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3778
"/    i == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3779
"/        ^ failBlock value   "not a parenthesis"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3780
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3781
"/    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
  3782
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3783
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3784
"/    col := startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3785
"/    line := startLine.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3786
"/    direction == #fwd ifTrue:[
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
"/    ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3791
"/        delta := -1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3792
"/        incSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3793
"/        decSet := #( $( $[ ${ "$<" ).
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
"/    anySet := Set new.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3796
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3797
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3798
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3799
"/    nesting := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3800
"/    ignoring := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3801
"/    lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3802
"/    maxLine := list size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3803
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3804
"/    col := col + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3805
"/    [nesting ~~ 0] whileTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3806
"/        (lineString notNil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3807
"/        and:[lineString includesAny:anySet]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3808
"/            direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3809
"/                endCol := lineString size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3810
"/            ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3811
"/                endCol := 1
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
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3814
"/            col to:endCol by:delta do:[:rCol |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3815
"/                runCol := rCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3816
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3817
"/                cc := lineString at:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3818
"/                runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3819
"/                    nextCC := lineString at:runCol+1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3820
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3821
"/                    nextCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3822
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3823
"/                runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3824
"/                    prevCC := lineString at:runCol-1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3825
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3826
"/                    prevCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3827
"/                ].
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
"/                ign := skip := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3830
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3831
"/                "/ check for comments.
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
"/                ((cc == $" and:[nextCC == $/])
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3834
"/                or:[prevCC == $$ ]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3835
"/                    "/ do nothing
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3836
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3837
"/                    skip := true.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3838
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3839
"/                    ignoreSet do:[:ignore |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3840
"/                        ignore == cc ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3841
"/                            ign := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3842
"/                        ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3843
"/                            ignore isString ifTrue:[
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3844
"/                                cc == (ignore at:2) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3845
"/                                    runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3846
"/                                        (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
  3847
"/                                            skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3848
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3849
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3850
"/                                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3851
"/                                    cc == (ignore at:1) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3852
"/                                        runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3853
"/                                            (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
  3854
"/                                                skip := true
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
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3861
"/                    ]
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
"/                ign ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3865
"/                    ignoring := ignoring not
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3866
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3867
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3868
"/                ignoring ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3869
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3870
"/                        (incSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3871
"/                            nesting := nesting + 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3872
"/                        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3873
"/                            (decSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3874
"/                                nesting := nesting - 1
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
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3877
"/                    ]
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
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3880
"/                nesting == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3881
"/                    "check if legal"
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
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3884
"/                        cc == closingChar ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3885
"/                            ^ failBlock value
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
"/                        ^ foundBlock value:line value:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3888
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3889
"/                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3890
"/            ].
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
"/        line := line + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3893
"/        (line < 1 or:[line > maxLine]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3894
"/            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3895
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3896
"/        lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3897
"/        direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3898
"/            col := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3899
"/        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3900
"/            col := lineString size
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3901
"/        ]
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
"/    ^ notFoundBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3904
3478
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3905
    "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
  3906
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3907
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3908
searchForMatchingParenthesisFromLine:startLine col:startCol
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3909
		     ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3910
		  ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3911
		     onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3912
	   openingCharacters:openingCharacters
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3913
	   closingCharacters:closingCharacters
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3914
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3915
    "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
  3916
     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
  3917
     backwards if its a closing parenthesis.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3918
     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
  3919
     If there is a nesting error, evaluate failBlock."
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3920
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3921
    ^ self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3922
	searchForMatchingParenthesisFromLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3923
	ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3924
	ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3925
	onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3926
	openingCharacters: openingCharacters
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3927
	closingCharacters: closingCharacters
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3928
	ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#())
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3929
	specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3930
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3931
"/    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3932
"/     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3933
"/     ignoring
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3934
"/     line   "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3935
"/     col    "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3936
"/     delta  "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3937
"/     endCol "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3938
"/     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3939
"/     cc prevCC nextCC incSet decSet
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3940
"/     nesting "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3941
"/     maxLine "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3942
"/     ign skip anySet|
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3943
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3944
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3945
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3946
"/    parChar := self characterAtLine:startLine col:startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3947
"/    i := charSet indexOf:parChar.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3948
"/    i == 0 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3949
"/        ^ failBlock value   "not a parenthesis"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3950
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3951
"/    direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3952
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3953
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3954
"/    col := startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3955
"/    line := startLine.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3956
"/    direction == #fwd ifTrue:[
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
"/    ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3961
"/        delta := -1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3962
"/        incSet := #( $) $] $} "$>" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3963
"/        decSet := #( $( $[ ${ "$<" ).
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
"/    anySet := Set new.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3966
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3967
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3968
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3969
"/    nesting := 1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3970
"/    ignoring := false.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3971
"/    lineString := list at:line.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3972
"/    maxLine := list size.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3973
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3974
"/    col := col + delta.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3975
"/    [nesting ~~ 0] whileTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3976
"/        (lineString notNil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3977
"/        and:[lineString includesAny:anySet]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3978
"/            direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3979
"/                endCol := lineString size.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3980
"/            ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3981
"/                endCol := 1
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
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3984
"/            col to:endCol by:delta do:[:rCol |
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3985
"/                runCol := rCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3986
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3987
"/                cc := lineString at:runCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3988
"/                runCol < lineString size ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3989
"/                    nextCC := lineString at:runCol+1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3990
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3991
"/                    nextCC := nil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3992
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3993
"/                runCol > 1 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3994
"/                    prevCC := lineString at:runCol-1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3995
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3996
"/                    prevCC := nil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3997
"/                ].
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
"/                ign := skip := false.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4000
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4001
"/                "/ check for comments.
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
"/                ((cc == $" and:[nextCC == $/])
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4004
"/                or:[prevCC == $$ ]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4005
"/                    "/ do nothing
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4006
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4007
"/                    skip := true.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4008
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4009
"/                    ignoreSet do:[:ignore |
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4010
"/                        ignore == cc ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4011
"/                            ign := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4012
"/                        ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4013
"/                            ignore isString ifTrue:[
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4014
"/                                cc == (ignore at:2) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4015
"/                                    runCol > 1 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4016
"/                                        (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4017
"/                                            skip := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4018
"/                                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4019
"/                                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4020
"/                                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4021
"/                                    cc == (ignore at:1) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4022
"/                                        runCol < lineString size ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4023
"/                                            (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4024
"/                                                skip := true
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
"/                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4031
"/                    ]
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
"/                ign ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4035
"/                    ignoring := ignoring not
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4036
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4037
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4038
"/                ignoring ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4039
"/                    skip ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4040
"/                        (incSet includes:cc) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4041
"/                            nesting := nesting + 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4042
"/                        ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4043
"/                            (decSet includes:cc) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4044
"/                                nesting := nesting - 1
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
"/                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4047
"/                    ]
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
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4050
"/                nesting == 0 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4051
"/                    "check if legal"
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
"/                    skip ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4054
"/                        cc == closingChar ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4055
"/                            ^ failBlock value
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
"/                        ^ foundBlock value:line value:runCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4058
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4059
"/                ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4060
"/            ].
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
"/        line := line + delta.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4063
"/        (line < 1 or:[line > maxLine]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4064
"/            ^ failBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4065
"/        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4066
"/        lineString := list at:line.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4067
"/        direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4068
"/            col := 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4069
"/        ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4070
"/            col := lineString size
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4071
"/        ]
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
"/    ^ notFoundBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4074
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4075
    "Modified: / 12-04-2007 / 11:25:36 / cg"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4076
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4077
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4078
searchForMatchingParenthesisFromLine:startLine col:startCol
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4079
		     ifFound:foundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4080
		  ifNotFound:notFoundBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4081
		     onError:failBlock
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4082
	   openingCharacters:openingCharacters
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4083
	   closingCharacters:closingCharacters
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4084
	   ignoredCharacters:ignoreSet
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4085
	  specialEOLComment:eolCommentSequence
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4086
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4087
    "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
  4088
     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
  4089
     backwards if its a closing parenthesis.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4090
     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
  4091
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4092
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4093
    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4094
     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4095
     ignoring
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4096
     line   "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4097
     col    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4098
     delta  "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4099
     endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4100
     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4101
     cc prevCC nextCC incSet decSet
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4102
     nesting "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4103
     maxLine "{ Class: SmallInteger }"
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4104
     ign skip anySet
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4105
     eol1 eol2|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4106
2772
4e04a3bf399f check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4107
    self assert:(openingCharacters size == closingCharacters size).
4e04a3bf399f check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4108
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4109
    charSet := openingCharacters , closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4110
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4111
    parChar := self characterAtLine:startLine col:startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4112
    i := charSet indexOf:parChar.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4113
    i == 0 ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4114
	^ failBlock value   "not a parenthesis"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4115
    ].
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4116
3858
1fd3e63fb456 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3851
diff changeset
  4117
    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
  4118
    closingChar := (closingCharacters , openingCharacters) at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4119
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4120
    eol1 := eolCommentSequence at:1 ifAbsent:nil.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4121
    eol2 := eolCommentSequence at:2 ifAbsent:nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4122
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4123
    col := startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4124
    line := startLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4125
    direction == #fwd ifTrue:[
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 := openingCharacters.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4128
	decSet := closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4129
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4130
	delta := -1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4131
	incSet := closingCharacters.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4132
	decSet := openingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4133
    ].
1454
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4134
    anySet := Set new.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4135
    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4136
    anySet := (anySet select:[:c | c isCharacter]) asString.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4137
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4138
    nesting := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4139
    ignoring := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4140
    lineString := list at:line.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4141
    maxLine := list size.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4142
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4143
    col := col + delta.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4144
    [nesting ~~ 0] whileTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4145
	(lineString notNil
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4146
	and:[lineString includesAny:anySet]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4147
	    direction == #fwd ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4148
		endCol := lineString size.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4149
	    ] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4150
		endCol := 1
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
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4153
	    col to:endCol by:delta do:[:rCol |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4154
		runCol := rCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4155
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4156
		cc := lineString at:runCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4157
		runCol < lineString size ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4158
		    nextCC := lineString at:runCol+1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4159
		] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4160
		    nextCC := nil
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4161
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4162
		runCol > 1 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4163
		    prevCC := lineString at:runCol-1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4164
		] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4165
		    prevCC := nil
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4166
		].
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
		ign := skip := false.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4169
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4170
		"/ check for comments.
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
		((cc == eol1 and:[nextCC == eol2])
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4173
		or:[prevCC == $$ ]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4174
		    "/ do nothing
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4175
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4176
		    skip := 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
		    ignoreSet do:[:ignore |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4179
			ignore == cc ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4180
			    ign := true
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4181
			] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4182
			    ignore isString ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4183
				cc == (ignore at:2) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4184
				    runCol > 1 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4185
					(lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4186
					    skip := true
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4187
					]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4188
				    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4189
				] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4190
				    cc == (ignore at:1) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4191
					runCol < lineString size ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4192
					    (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4193
						skip := true
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
			]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4200
		    ]
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
		ign ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4204
		    ignoring := ignoring not
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4205
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4206
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4207
		ignoring ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4208
		    skip ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4209
			(incSet includes:cc) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4210
			    nesting := nesting + 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4211
			] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4212
			    (decSet includes:cc) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4213
				nesting := nesting - 1
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
			]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4216
		    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4217
		].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4218
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4219
		nesting == 0 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4220
		    "check if legal"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4221
		    skip ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4222
			cc == closingChar ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4223
			    ^ failBlock value
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
			^ foundBlock value:line value:runCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4226
		    ]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4227
		]
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4228
	    ].
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
	line := line + delta.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4231
	(line < 1 or:[line > maxLine]) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4232
	    ^ failBlock value
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4233
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4234
	lineString := list at:line.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4235
	direction == #fwd ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4236
	    col := 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4237
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4238
	    col := lineString size
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4239
	]
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
    ^ notFoundBlock value
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4242
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  4243
    "Modified: 15.10.1996 / 12:22:30 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4244
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4245
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4246
searchFwd
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4247
    "search forward for the same pattern or selection again"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4248
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4249
    |ign match variable|
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  4250
2811
3a7aed97fd76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  4251
    searchAction notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4252
	"/ autosearch is cleared whenever there is search with user selection
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4253
	(self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
4177
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4254
    ].
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4255
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4256
    searchAction notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4257
	"/ 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
  4258
	self searchUsingSearchAction:#forward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4259
	^ self.
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4260
    ].
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  4261
    searchBarActionBlock notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4262
	searchBarActionBlock value:#forward value:self.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4263
	^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4264
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4265
    lastSearchWasVariableSearch ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4266
	variable := self syntaxElementForSelectedVariable.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4267
	variable notNil ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4268
	    self searchVariableWithSyntaxElement:variable forward:true.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4269
	    ^ self.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4270
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4271
	lastSearchWasVariableSearch := false.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4272
    ].
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4273
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4274
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4275
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  4276
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4277
    selectStyle == #wordLeft ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4278
	"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4279
	 remove the space from the selection
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4280
	"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4281
	selectionStartCol := selectionStartCol + 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4282
	super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4283
	selectStyle := #word.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4284
	self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4285
    ].
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4286
    self setSearchPatternWithMatchEscapes: match.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4287
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4288
    lastSearchPattern isNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4289
	LastSearchPatterns size > 0 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4290
	    lastSearchPattern := LastSearchPatterns first
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4291
	]
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4292
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4293
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4294
    lastSearchPattern notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4295
	self rememberSearchPattern:lastSearchPattern.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4296
	lastSearchDirection := #forward.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4297
	self
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4298
	    searchFwd:lastSearchPattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4299
	    ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4300
	    match: match
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4301
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4302
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4303
    "Modified: / 08-03-2012 / 14:25:42 / cg"
248
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4306
searchFwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4307
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4308
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4309
    self searchFwd:pattern ifAbsent:[self showNotFound].
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4310
"/    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4311
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4312
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4313
    "Modified: / 21-09-2006 / 16:52:04 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4314
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4315
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4316
searchFwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4317
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4318
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4319
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4320
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4321
				pattern:pattern)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4322
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4323
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4324
    "Modified: / 21-09-2006 / 16:51:28 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4325
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4327
searchFwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4328
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4329
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4330
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4331
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4332
				pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4333
				ignoreCase:ign)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4334
	ifAbsent:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4335
		    self sensor compressKeyPressEventsWithKey:#FindNext.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4336
		    self showNotFound
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4337
		 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4338
    "/ lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4339
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4340
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4341
    "Created: / 13-09-1997 / 06:18:13 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4342
    "Modified: / 23-03-2012 / 12:09:59 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4343
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4344
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4345
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4346
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4347
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4348
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4349
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4350
				pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4351
				ignoreCase:ign)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4352
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4353
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4354
    "Modified: 13.9.1997 / 01:05:35 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4355
    "Created: 13.9.1997 / 06:18:27 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4356
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4357
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4358
searchFwd:pattern ignoreCase:ign match: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4359
    "do a forward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4360
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4361
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4362
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4363
				pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4364
				ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4365
				match:match)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4366
	ifAbsent:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4367
		    self sensor compressKeyPressEventsWithKey:#FindNext.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4368
		    self showNotFound
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4369
		 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4370
    "/ lastSearchIgnoredCase := ign.
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4371
    "/ lastSearchWasMatch := match.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4372
    lastSearchPattern := pattern string
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4373
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4374
    "Created: / 13-09-1997 / 06:18:13 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4375
    "Modified: / 23-03-2012 / 12:12:47 / cg"
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4376
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4377
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4378
searchFwd:pattern ignoreCase:ign match: match ifAbsent:aBlock
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4379
    "do a forward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4380
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4381
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4382
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4383
				pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4384
				ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4385
				match:match)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4386
	ifAbsent:aBlock
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4387
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4388
    "Modified: 13.9.1997 / 01:05:35 / cg"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4389
    "Created: 13.9.1997 / 06:18:27 / cg"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4390
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4391
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4392
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4393
    "do a forward search"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4394
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4395
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4396
	searchFwdUsingSpec:(ListView::SearchSpec new
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4397
				pattern:pattern
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4398
				ignoreCase:ign
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4399
				match:match)
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4400
	startingAtLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4401
	ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4402
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4403
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4404
searchFwdUsingSpec:searchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4405
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4406
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4407
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4408
	searchFwdUsingSpec:searchSpec
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4409
	ifAbsent:[self showNotFound].
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4410
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4411
"/    lastSearchIgnoredCase := false.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4412
    lastSearchPattern := searchSpec pattern string
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4413
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4414
    "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
  4415
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4416
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4417
searchFwdUsingSpec:searchSpec ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4418
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4419
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4420
    |pos startLine startCol|
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4421
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4422
    pos := self startPositionForSearchForward.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4423
    startLine := pos y.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4424
    startCol := pos x.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4425
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4426
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4427
	searchFwdUsingSpec:searchSpec
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4428
	startingAtLine:startLine col:startCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4429
	ifAbsent:aBlock
4462
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
    "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
  4432
    "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
  4433
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4434
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4435
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
  4436
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4437
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4438
    self
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4439
	searchForwardUsingSpec:searchSpec
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4440
	startingAtLine:startLine col:startCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4441
	ifFound:[:line :col :endColOrNil|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4442
	    self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4443
	]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4444
	ifAbsent:aBlock
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4445
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4446
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4447
searchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4448
    "return the last search pattern"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4449
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4450
    ^ lastSearchPattern
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4451
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4452
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4453
searchUsingSearchAction:direction
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4454
    "search using a searchaction which has been given by someone else.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4455
     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
  4456
      a language aware search (as opposed to a naive string search)"
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4457
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4458
    self
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4459
	searchUsingSearchAction:direction
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4460
	ifAbsent:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4461
		    self sensor compressKeyPressEventsWithKey:#FindNext.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4462
		    self showNotFound
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4463
		 ]
2816
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4464
!
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4465
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4466
searchUsingSearchAction:direction ifAbsent:notFoundAction
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4467
    "search using a searchaction which has been given by someone else.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4468
     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
  4469
      a language aware search (as opposed to a naive string search)"
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4470
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4471
    |pos startLine startCol|
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4472
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4473
    pos :=  direction == #backward
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4474
		ifTrue:[self startPositionForSearchBackward]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4475
		ifFalse:[self startPositionForSearchForward].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4476
    startLine := pos y.
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4477
    startCol := pos x.
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4478
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4479
    searchAction notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4480
	searchAction
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4481
	    value:direction
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4482
	    value:startLine
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4483
	    value:startCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4484
	    value:[:line :col | self selectFromLine:line toLine:line]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4485
	    value:notFoundAction.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4486
	self hasSelection ifTrue: [
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4487
	    self changeTypeOfSelectionTo: #searchAction.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4488
	].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4489
    ].
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4490
!
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4491
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4492
setSearchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4493
    "set the searchpattern from the selection if there is one"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4494
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4495
    self setSearchPatternWithMatchEscapes: false.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4496
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4497
3904
dd4c2dace4f5 changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents: 3892
diff changeset
  4498
setSearchPattern:aStringOrNil
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4499
    "set the searchpattern for future searches"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4500
3904
dd4c2dace4f5 changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents: 3892
diff changeset
  4501
    aStringOrNil isEmptyOrNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4502
	lastSearchPattern := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4503
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4504
	"/ not withoutSeparators: may want to search for spaces...
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4505
	lastSearchPattern := aStringOrNil asString "withoutSeparators" string.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4506
    ].
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4507
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4508
    "Modified: / 6.3.1999 / 23:47:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4509
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4510
2200
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4511
setSearchPattern:aString ignoreCase:aBoolean
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4512
    "set the searchpattern and caseIgnore for future searches"
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4513
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4514
    self setSearchPattern:aString.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4515
    lastSearchIgnoredCase := aBoolean.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4516
!
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4517
5713
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4518
setSearchPattern:aString ignoreCase:ignoreCaseBoolean match:matchBoolean
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4519
    "set the searchpattern and caseIgnore for future searches"
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
    self setSearchPattern:aString.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4522
    lastSearchIgnoredCase := ignoreCaseBoolean.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4523
    lastSearchWasMatch := matchBoolean.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4524
!
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4525
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4526
setSearchPatternWithMatchEscapes: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4527
    "set the searchpattern from the selection if there is one"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4528
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4529
    |sel searchPattern |
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4530
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4531
"/    clickPos isNil ifTrue:[^ self].
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4532
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4533
    sel := self selection.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4534
    sel notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4535
	searchPattern := sel asString.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4536
	match ifTrue:[searchPattern := searchPattern withMatchEscapes].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4537
	self setSearchPattern:searchPattern.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4538
    ]
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4539
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4540
    "Modified: / 6.3.1999 / 23:48:04 / cg"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4541
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4542
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4543
showMatch:pattern atLine:line col:col
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4544
    <resource: #obsolete>
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4545
    "after a search, highlight the matched pattern.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4546
     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
  4547
     (for now, it only highlights simple patterns and '*string*' correctly)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4548
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4549
    self showMatch:pattern isMatch:true atLine:line col:col endCol:nil
4120
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4550
!
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4551
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4552
showMatch:pattern isMatch:isMatch atLine:line col:col
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4553
    <resource: #obsolete>
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4554
    "after a search, highlight the matched pattern."
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4555
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4556
    self showMatch:pattern isMatch:isMatch atLine:line col:col endCol:nil
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4557
!
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4558
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4559
showMatch:pattern isMatch:isMatch atLine:line col:col endCol:encColOrNil
4120
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4560
    "after a search, highlight the matched pattern.
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4561
     The code below needs a rewrite to take care of match-characters
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4562
     (for now, it only highlights simple patterns and '*string*' correctly)"
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4563
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4564
    |endCol realPattern|
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4565
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4566
    (endCol := encColOrNil) isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4567
	"/ a hack.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4568
	realPattern := pattern.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4569
	isMatch ifTrue: [
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4570
	    (realPattern startsWith:$*) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4571
		realPattern := realPattern copyButFirst
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4572
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4573
	    (realPattern endsWith:$*) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4574
		realPattern := realPattern copyButLast
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4575
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4576
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4577
	endCol := (col + realPattern size - 1).
248
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
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4580
    self selectFromLine:line col:col toLine:line col:endCol.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4581
    self makeLineVisible:line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4582
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4583
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4584
showNotFound
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4585
    "search not found - tell user by beeping and changing
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4586
     cursor for a while (sometimes I work with a headset :-)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4587
     (used to be: tell user by changing cursor for a while)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4588
5052
70780a6ab673 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5046
diff changeset
  4589
    self withCursor:(Cursor cross) do:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4590
	self beep.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4591
	Processor activeProcess millisecondDelay:200.
1028
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4592
    ]
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4593
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4594
    "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
  4595
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4596
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4597
startPositionForSearchBackward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4598
    ^ self startPositionForSearchBackwardBasedOnSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4599
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4600
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4601
startPositionForSearchBackwardBasedOnSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4602
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4603
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4604
    selectionStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4605
	startLine := selectionStartLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4606
	startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4607
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4608
	startLine := 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4609
	startCol := 1
2756
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
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4612
    ^ startCol @ startLine
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4613
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4614
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4615
startPositionForSearchForward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4616
    ^ self startPositionForSearchForwardBasedOnSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4617
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4618
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4619
startPositionForSearchForwardBasedOnSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4620
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4621
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4622
    selectionStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4623
	startLine := selectionStartLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4624
	startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4625
    ] ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4626
	startLine := 1.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4627
	startCol := 1
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4628
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4629
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4630
    ^ startCol @ startLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4631
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4632
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4633
!TextView methodsFor:'selections'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4634
2604
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4635
changeTypeOfSelectionTo:newType
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4636
    "ignored here - but redefined in subclasses which
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4637
     differentiate between pasted- and user-selections"
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4638
!
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4639
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4640
expandSelectionDown
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4641
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4642
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4643
    selectionStartLine notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4644
	expandingTop == true ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4645
	    l := selectionStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4646
	    selectionStartLine := selectionStartLine + 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4647
	    (selectionStartLine > clickLine
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4648
	    or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4649
	    ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4650
		t := selectionStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4651
		selectionStartLine := selectionEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4652
		selectionEndLine := t.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4653
		t := selectionStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4654
		selectionStartCol := selectionEndCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4655
		selectionEndCol := t.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4656
		expandingTop := false
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4657
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4658
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4659
	    l := selectionEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4660
	    selectionEndLine := selectionEndLine + 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4661
	].
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4662
"/        self redrawLine:l.
2442
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4663
"/        self redrawLine:l+1.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4664
	self validateNewSelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4665
	self setPrimarySelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4666
	self selectionChanged.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4667
	self redrawFromLine:l to:l+1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4668
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4669
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4670
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4671
    "Created: / 01-03-1996 / 23:35:08 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4672
    "Modified: / 18-03-1996 / 17:18:15 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4673
    "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
  4674
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4675
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4676
expandSelectionLeft
502
6f3d0d7a782c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  4677
    |c l t c1 c2|
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4678
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4679
    selectionStartLine notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4680
	expandingTop == true ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4681
	    selectionStartCol == 0 ifTrue:[^ self].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4682
	    l := selectionStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4683
	    selectionStartCol := (selectionStartCol - 1) max:1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4684
	    c := selectionStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4685
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4686
	    l := selectionEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4687
	    selectionEndCol := (selectionEndCol - 1) max:0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4688
	    c := selectionEndCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4689
	    selectionEndLine == selectionStartLine ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4690
		selectionEndCol <= selectionStartCol ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4691
		    t := selectionStartCol. selectionStartCol := selectionEndCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4692
		    selectionEndCol := t.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4693
		    expandingTop := true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4694
		    c := selectionStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4695
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4696
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4697
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4698
	c1 := c.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4699
	c2 := c1 + 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4700
	c1 == 0 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4701
	    c1 := 1
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4702
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4703
	self validateNewSelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4704
	self setPrimarySelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4705
	self selectionChanged.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4706
	self redrawLine:l from:c1 to:c2.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4707
	self makeSelectionVisible.
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
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4710
    "Modified: / 18-03-1996 / 17:05:46 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4711
    "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
  4712
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4713
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4714
expandSelectionRight
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4715
    |l c t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4716
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4717
    selectionStartLine notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4718
	expandingTop == true ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4719
	    l := selectionStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4720
	    c := selectionStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4721
	    selectionStartCol := selectionStartCol + 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4722
	    l == selectionEndLine ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4723
		c >= selectionEndCol ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4724
		    expandingTop := false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4725
		    t := selectionStartCol. selectionStartCol := selectionEndCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4726
		    selectionEndCol := t.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4727
		    c := selectionStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4728
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4729
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4730
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4731
	    l := selectionEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4732
	    c := selectionEndCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4733
	    selectionEndCol := selectionEndCol + 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4734
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4735
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4736
	self validateNewSelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4737
	self setPrimarySelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4738
	self selectionChanged.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4739
	self redrawLine:l from:(c max:1) to:c+1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4740
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4741
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4742
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4743
    "Created: / 01-03-1996 / 23:33:17 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4744
    "Modified: / 06-03-1996 / 13:54:10 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4745
    "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
  4746
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4747
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4748
expandSelectionUp
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4749
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4750
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4751
    selectionStartLine notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4752
	expandingTop == true ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4753
	    selectionStartLine := (selectionStartLine - 1) max:1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4754
	    l := selectionStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4755
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4756
	    selectionEndLine := (selectionEndLine - 1) max:0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4757
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4758
	    l := selectionEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4759
	    (selectionEndLine < clickLine
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4760
	    or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4761
	    ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4762
		t := selectionStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4763
		selectionStartLine := selectionEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4764
		selectionEndLine := t.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4765
		t := selectionStartCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4766
		selectionStartCol := selectionEndCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4767
		selectionEndCol := t.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4768
		l := selectionStartLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4769
		expandingTop := true
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4770
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4771
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4772
	self validateNewSelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4773
	self setPrimarySelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4774
	self selectionChanged.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4775
	"/ self redrawLine:l.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4776
	"/ self redrawLine:l+1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4777
	self redrawFromLine:l to:l+1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4778
	self makeSelectionVisible.
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
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4781
    "Modified: / 06-03-1996 / 14:12:06 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4782
    "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
  4783
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4784
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4785
hasSelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4786
    "return true, if there is a selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4787
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4788
    ^ selectionStartLine notNil
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4789
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4790
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4791
hasSelectionForCopy
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4792
    "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
  4793
     (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
  4794
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4795
    ^ self hasSelection
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4796
!
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4797
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4798
hasSelectionWithinSingleLine
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4799
    "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
  4800
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4801
    ^ selectionStartLine notNil
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4802
      and:[ selectionStartLine == selectionEndLine ]
3315
1b42d2f8dcbc CRLF management
fm
parents: 3308
diff changeset
  4803
1b42d2f8dcbc CRLF management
fm
parents: 3308
diff changeset
  4804
    "Modified: / 04-07-2006 / 18:42:59 / fm"
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4805
!
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4806
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4807
hasSingleFullLineSelected
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4808
    ^ (selectionStartLine notNil
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4809
      and:[selectionEndLine notNil
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4810
      and:[selectionEndLine == (selectionStartLine+1)
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4811
      and:[selectionStartCol == 1
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4812
      and:[selectionEndCol == 0
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4813
    ]]]])
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4814
!
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4815
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4816
isInSelection:line col:aColNr
96256221e3af support drag
ca
parents: 2581
diff changeset
  4817
    "returns true, if the line, and column is in the selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  4818
    "
3438
d83030fd5005 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3426
diff changeset
  4819
    selectionStartLine isNil ifTrue:[^ false].
d83030fd5005 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3426
diff changeset
  4820
    selectionEndLine   isNil ifTrue:[^ false].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4821
96256221e3af support drag
ca
parents: 2581
diff changeset
  4822
    (line between:selectionStartLine and:selectionEndLine) ifFalse:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4823
	^ 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 == selectionStartLine ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4827
	aColNr < selectionStartCol ifTrue:[^ false]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4828
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  4829
96256221e3af support drag
ca
parents: 2581
diff changeset
  4830
    line == selectionEndLine ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4831
	(selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4832
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  4833
    ^ true
96256221e3af support drag
ca
parents: 2581
diff changeset
  4834
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  4835
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4836
makeSelectionVisible
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4837
    "scroll to make the selection visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4838
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4839
    |line col|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4840
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4841
    selectionStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4842
	expandingTop == true ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4843
	    line := selectionStartLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4844
	    col := selectionStartCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4845
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4846
	    line := selectionEndLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4847
	    col := selectionEndCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4848
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4849
	self makeLineVisible:line.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4850
	self makeColVisible:col inLine:line.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4851
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4852
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4853
    "Modified: 6.3.1996 / 13:53:45 / cg"
248
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4856
selectAll
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4857
    "select the whole text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4858
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4859
    self selectFromLine:1 col:1 toLine:(list size + 1) col:0
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4860
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4861
4140
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4862
selectFromCharacterPosition:pos1
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4863
    "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
  4864
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4865
    |line1 col1 line2 col2|
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4866
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4867
    line1 := self lineOfCharacterPosition:pos1.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4868
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
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
    line2 := (list size + 1).
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4871
    col2 := 0.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4872
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4873
!
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  4874
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4875
selectFromCharacterPosition:pos1 to:pos2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4876
    "compute line/col from character positions and select the text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4877
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4878
    |line1 col1 line2 col2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4879
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4880
    pos1 > pos2 ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4881
	^ self unselect
4554
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
    line1 := self lineOfCharacterPosition:pos1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4884
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4885
    col1 < 1 ifTrue:[ col1 := 1 ].
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4886
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4887
    line2 := self lineOfCharacterPosition:pos2.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4888
    col2 := pos2 - (self characterPositionOfLine:line2 col:1) + 1.
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  4889
    col2 < 1 ifTrue:[ col2 := 1 ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4890
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4891
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4892
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4893
selectFromLine:startLine col:startCol toLine:endLine col:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4894
    "select a piece of text and redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4895
5046
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  4896
    ((selectionStartLine = startLine)
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  4897
      and:[ (selectionStartCol = startCol)
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  4898
      and:[ (selectionEndLine = endLine)
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  4899
      and:[ (selectionEndCol = endCol) ]]]) ifTrue:[^ self ].
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  4900
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4901
    self unselect.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4902
    startLine notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4903
	"new:"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4904
	endLine < startLine ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4905
	    ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4906
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4907
	(endLine == startLine and:[endCol < startCol]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4908
	    endCol ~~ 0 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4909
		self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4910
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4911
	    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4912
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4913
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4914
" old:
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4915
	endLine < startLine ifTrue:[^ self].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4916
	(startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4917
"
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4918
	selectionStartLine := startLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4919
	selectionStartCol := startCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4920
	selectionEndLine := endLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4921
	selectionEndCol := endCol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4922
	self validateNewSelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4923
	self setPrimarySelection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4924
	self selectionChanged.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4925
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4926
	(selectionStartLine == selectionEndLine) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4927
	    self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4928
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4929
	    selectionStartLine to:selectionEndLine do:[:lineNr |
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4930
		self redrawLine:lineNr
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4931
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4932
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4933
	selectStyle := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4934
    ]
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4935
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4936
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4937
     |v|
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
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4940
     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
  4941
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4942
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4943
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4944
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4945
     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
  4946
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4947
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4948
    "Modified: / 02-01-1997 / 13:32:25 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4949
    "Modified: / 17-04-2012 / 21:00:50 / 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
  4950
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4951
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4952
selectFromLine:startLine toLine:endLine
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4953
    "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
  4954
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4955
    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
  4956
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
     |v|
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
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4961
     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
  4962
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4963
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4964
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4965
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4966
     v selectFromLine:2 toLine:10
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  4967
    "
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
    "Modified: 29.4.1996 / 12:23:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4970
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4971
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4972
selectLine:selectLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4973
    "select one line and redraw it"
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
    self selectFromLine:selectLine col:1 toLine:(selectLine + 1) col:0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4976
    wordStartCol := selectionStartCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4977
    wordEndCol := selectionEndCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4978
    wordStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4979
    wordEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4980
    selectStyle := #line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4981
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4982
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4983
selectLineAtY:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4984
    "select the line at given y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4985
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  4986
    |selectLine|
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  4987
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  4988
    selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4989
    selectLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  4990
	self selectLine:selectLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4991
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4992
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4993
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4994
selectLineWhereCharacterPosition:pos
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4995
    "select the line, where characterPosition pos is living.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4996
     The argument pos starts at 1 from the start of the text
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4997
     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
  4998
     character position within a string to line-position in view)."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4999
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5000
    self selectLine:(self lineOfCharacterPosition:pos)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5001
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5002
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5003
selectWordAtLine:line col:col
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5004
    "select the word at given line/col"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5005
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  5006
    self
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5007
	wordAtLine:line col:col do:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5008
	    :beginLine :beginCol :endLine :endCol :style |
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5009
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5010
	    self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5011
	    selectStyle := style
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5012
	]
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5013
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5014
    "Modified: 18.3.1996 / 17:30:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5015
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5016
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5017
selectWordAtX:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5018
    "select the word at given x/y-(view-)coordinate"
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
    |selectVisibleLine selectLine selectCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5021
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5022
    selectStyle := nil.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5023
    selectVisibleLine := self visibleLineOfY:y.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5024
    selectLine := self visibleLineToListLine:selectVisibleLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5025
    selectLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5026
	selectCol := self colOfX:x inVisibleLine:selectVisibleLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5027
	self selectWordAtLine:selectLine col:selectCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5028
    ]
1661
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5029
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5030
    "Modified: / 8.9.1998 / 21:22:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5031
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5032
3528
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5033
selectedInterval
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5034
    "return the selection-boundaries as interval"
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5035
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5036
    ^ self selectionStartIndex to:(self selectionStopIndex - 1)
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5037
!
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5038
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5039
selection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5040
    "return the selection as a collection of (line-)strings.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5041
     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
  5042
     collection will be an empty string."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5043
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5044
    |sel|
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5045
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5046
    selectionStartLine isNil ifTrue:[^ nil].
4466
5c7a01426564 changed: #selection
Claus Gittinger <cg@exept.de>
parents: 4462
diff changeset
  5047
    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
  5048
    sel notEmptyOrNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5049
	"/ this is rubbish; we are now always using unicode internally
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5050
	"/ any many more conversions would be needed at many places...
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5051
	(gc characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5052
	    sel := sel encodeFrom:gc characterEncoding into:#'iso10646-1'
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5053
	].
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5054
    ].
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5055
    ^ sel
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
  5056
4361
646cd7c5513e comment/format in: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents: 4321
diff changeset
  5057
    "Modified (comment): / 25-01-2012 / 00:29:09 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5058
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5059
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5060
selectionAsString
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5061
    "return the selection as a String (i.e. without emphasis)"
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5062
2693
9e7da8ff444d unused methodLocals removed
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
  5063
    |sel|
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5064
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5065
    (sel := self selection) isNil ifTrue:[^ nil].
2419
2ae3350454bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  5066
    sel := sel collect:[:each| each isNil ifTrue:[nil] ifFalse:[each string]].
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5067
    ^ (sel asStringWithCRsFrom:1 to:(sel size) compressTabs:false withCR:false) string
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5068
!
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5069
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5070
selectionChanged
5658
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5071
    "can be redefined for notification or special actions.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5072
     If you do, do not forget to do a super selectionChanged"
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5073
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5074
    self changed:#selection.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5075
"/    self selectionHolder value:{ selectionStartCol @ selectionStartLine .
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5076
"/                                 selectionEndCol @ selectionEndLine }
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5077
!
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5078
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5079
selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5080
    ^ selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5081
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5082
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5083
selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5084
    ^ selectionEndLine
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5087
selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5088
    ^ selectionStartCol
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5091
selectionStartLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5092
    ^ selectionStartLine
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
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5095
setPrimarySelection
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5096
    "can be redefined for notification or special actions"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5097
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5098
    device notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5099
	"On X11, be nice and set the PRIMARY selection.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5100
	 (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5101
	device setPrimaryText: self selectionAsString ownerView: self.
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5102
    ].
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5103
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5104
    "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
  5105
!
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5106
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5107
st80SelectMode
3459
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5108
    st80SelectMode notNil ifTrue:[^ st80SelectMode].
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5109
    ^ self class st80SelectMode
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5110
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5111
    "Created: / 03-07-2006 / 16:30:59 / cg"
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5112
!
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5113
3459
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5114
st80SelectMode:aBoolean
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5115
    st80SelectMode := aBoolean
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5116
!
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5117
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5118
unselect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5119
    "unselect - if there was a selection redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5120
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5121
    |startLine endLine startVisLine endVisLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5122
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5123
    selectionStartLine notNil ifTrue:[
5677
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5124
	startLine := selectionStartLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5125
	endLine := selectionEndLine.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5126
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5127
	self unselectWithoutRedraw.
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5128
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5129
	"/ if the selection is not visible, we are done
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5130
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5131
	startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5132
	endLine < firstLineShown ifTrue:[^ self].
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 ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5135
	    startVisLine := 1
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5136
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5137
	    startVisLine := self listLineToVisibleLine:startLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5138
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5139
	endLine >= (firstLineShown + nLinesShown) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5140
	    endVisLine := nLinesShown
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5141
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5142
	    endVisLine := self listLineToVisibleLine:endLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5143
	].
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5144
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5145
	"/ 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
  5146
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5147
	(startLine == endLine) ifTrue:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5148
	    super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5149
	] ifFalse:[
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5150
	    self redrawFromVisibleLine:startVisLine to:endVisLine
fa9074e87571 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  5151
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5152
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5153
    selectStyle := nil
503
468d4a36ed67 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
  5154
715
a5856fcdbf0f fixed unselect-redraw
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  5155
    "Modified: 29.5.1996 / 14:54:11 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5156
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5157
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5158
unselectWithoutRedraw
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5159
    "forget selection but do not redraw the selection area
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5160
     - 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
  5161
     known to be invisible (however, redraw knows about that anyway)."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5162
2735
5ba2010aefa4 *** empty log message ***
penk
parents: 2730
diff changeset
  5163
    selectionStartLine := selectionEndLine := nil.
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5164
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5165
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5166
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5167
validateNewSelection
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5168
     "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
  5169
      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
  5170
      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
  5171
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5172
    ^ self
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5173
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5174
    "Modified: 29.4.1996 / 12:32:08 / cg"
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5175
!
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5176
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5177
withSelectionForeground:hilightFg background:hilightBg do:aBlock
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5178
    "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
  5179
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5180
    |oldFg oldBg|
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5181
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
     change color of selection & hide cursor
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
    oldFg := selectionFgColor.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5186
    oldBg := selectionBgColor.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5187
    selectionBgColor := hilightBg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5188
    selectionFgColor := hilightFg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5189
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5190
    expandingTop := true.       "/ hack to make the top of the selection visible
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5191
    self makeSelectionVisible.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5192
    selectionStartLine notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5193
	selectionEndLine notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5194
	    self redrawFromLine:selectionStartLine to:selectionEndLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5195
	].
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5196
    ].
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5197
    self flush.
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
    aBlock ensure:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5200
	"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5201
	 undo selection color change and show cursor again
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5202
	"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5203
	selectionFgColor := oldFg.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5204
	selectionBgColor := oldBg.
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5205
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5206
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5207
4310
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5208
!TextView methodsFor:'testing'!
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5209
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5210
isTextView
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5211
    "I am showing text"
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
    ^ true
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5214
! !
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5215
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  5216
!TextView class methodsFor:'documentation'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5217
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5218
version
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  5219
    ^ '$Header$'
3964
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5220
!
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5221
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5222
version_CVS
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  5223
    ^ '$Header$'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5224
! !
2630
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
  5225
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  5226
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  5227
TextView initialize!