TextView.st
author Stefan Vogel <sv@exept.de>
Thu, 18 Oct 2018 18:45:53 +0200
changeset 6456 c01624d73342
parent 6454 64f4dc5b8c5a
child 6459 070961cd245f
permissions -rw-r--r--
#BUGFIX by stefan class: TextView comment/format in: #doubleClickX:y: #searchForMatchingParenthesisFromLine:col:ifFound:ifNotFound:onError:openingCharacters:closingCharacters:ignoredCharacters:specialEOLComment: When searching, do not fail on single ' or \" in a line comment Really check for matching pairs of () and [], do not accept e.g. (] or [) as matching pairs
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
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
     3
              All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
2191
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    12
"{ Package: 'stx:libwidg' }"
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    13
5247
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
    14
"{ NameSpace: Smalltalk }"
a167bc63efaf class: TextView
Claus Gittinger <cg@exept.de>
parents: 5236
diff changeset
    15
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    16
ListView subclass:#TextView
5902
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    17
	instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    18
		selectionEndCol clickPos clickStartLine clickStartCol clickLine
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    19
		clickCol clickCount expandingTop wordStartCol wordStartLine
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    20
		wordEndCol wordEndLine selectionFgColor selectionBgColor
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    21
		selectStyle directoryForFileDialog defaultFileNameForFileDialog
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    22
		externalEncoding contentsWasSaved searchAction lastSearchPattern
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    23
		lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    24
		lastSearchWasVariableSearch parenthesisSpecification dropSource
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    25
		dragIsActive saveAction st80SelectMode searchBarActionBlock'
6324
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
    26
	classVariableNames:'DefaultAlternativeSelectionBackgroundColor
5902
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    27
		DefaultAlternativeSelectionForegroundColor
6324
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
    28
		DefaultParenthesisSpecification DefaultSelectionBackgroundColor
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
    29
		DefaultSelectionForegroundColor DefaultViewBackground
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
    30
		LastSearchIgnoredCase LastSearchPatterns LastSearchReplacedString
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
    31
		LastSearchWasMatch LastSearchWasMatchWithRegex
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
    32
		LastSearchWasReplace LastSearchWasWrapAtEndOfText MatchDelayTime
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
    33
		NumRememberedSearchPatterns WordSelectCatchesBlanks'
5902
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    34
	poolDictionaries:''
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    35
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    36
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    37
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
    38
!TextView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    39
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    40
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    41
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    42
 COPYRIGHT (c) 1989 by Claus Gittinger
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    43
              All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    44
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    45
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    46
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    47
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    48
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    49
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    50
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    51
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    52
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    53
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
    54
documentation
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    55
"
120
claus
parents: 119
diff changeset
    56
    a view for readOnly text - this class adds selections to a simple list.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    57
    The text is not editable and there is no cursor.
120
claus
parents: 119
diff changeset
    58
    Use TextViews for readonly text, EditTextView for editable text.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    59
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    60
    Please read the historic notice in the ListView class.
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    61
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
    62
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    63
120
claus
parents: 119
diff changeset
    64
      selectionStartLine      <Number>                the line of the selection start (or nil)
claus
parents: 119
diff changeset
    65
      selectionStartCol       <Number>                the col of the selection start
claus
parents: 119
diff changeset
    66
      selectionEndLine        <Number>                the line of the selection end
claus
parents: 119
diff changeset
    67
      selectionEndCol         <Number>                the col of the selection end
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    68
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    69
      clickStartLine          <Number>                temporary - remember where select operation started
120
claus
parents: 119
diff changeset
    70
      clickStartCol           <Number>                temporary
claus
parents: 119
diff changeset
    71
      clickLine               <Number>                temporary
claus
parents: 119
diff changeset
    72
      clickCol                <Number>                temporary
claus
parents: 119
diff changeset
    73
      clickCount              <Number>                temporary
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    74
      expandingTop            <Boolean>               temporary - for expandSelection
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    75
120
claus
parents: 119
diff changeset
    76
      selectionFgColor        <Color>                 color used to draw selections
claus
parents: 119
diff changeset
    77
      selectionBgColor        <Color>                 color used to draw selections
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    78
120
claus
parents: 119
diff changeset
    79
      selectStyle             <Symbol>                how words are selected
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    80
120
claus
parents: 119
diff changeset
    81
      directoryForFileDialog  <nil|pathName>          directory where save dialog should start
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    82
120
claus
parents: 119
diff changeset
    83
      contentsWasSaved        <Boolean>               set to true, whenever saved in a file
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
    84
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
    85
      externalEncoding        <Symbol|nil>            external encoding, used when text is saved to
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    86
                                                      a file. Usually something like
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    87
                                                      #jis7, #euc, #sjis etc.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    88
                                                      (currently only passed down from the
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    89
                                                       fileBrowser)
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
    90
96256221e3af support drag
ca
parents: 2581
diff changeset
    91
      dropSource              <DropSource>            drag operation descriptor or nil (dragging disabled)
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    92
      dragIsActive            <Boolean>               true, drag operation is activated
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    93
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    94
      searchAction            <Block>                 an autosearch action; typically set by the browser.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    95
                                                      Will be used as default when searchFwd/searchBwd is
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    96
                                                      pressed. If the searchPattern is changed, no autosearch
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    97
                                                      action will be executed.
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
    98
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
    99
      searchBarActionBlock    <Block>                 search action block for embedded search
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   100
                                                      panel. Used as second chance for searchFwd/bwd
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   101
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   102
    [class variables:]
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   103
        ST80Selections        <Boolean>               enables ST80 style doubleclick behavior
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   104
                                                      (right after opening parenthesis, right before
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   105
                                                       closing parenthesis, at begin of a line
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   106
                                                       at begin of text)
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   107
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   108
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   109
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   110
      textView.background                       defaults to viewBackground
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   111
      textView.ViewFont                         defaults to textFont
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   112
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   113
      text.st80Selections                       st80 behavior (click on char after parent or quote)
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   114
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   115
      text.selectionForegroundColor             defaults to textBackgroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   116
      text.selectionBackgroundColor             defaults to textForegroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   117
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   118
      text.alternativeSelectionForegroundColor  pasted text (i.e. paste will not replace)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   119
                                                defaults to selectionForegroundColor
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   120
      text.alternativeSelectionBackgroundColor  pasted text (i.e. paste will not replace)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   121
                                                defaults to selectionBackgroundColor
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   122
    [author:]
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   123
        Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   124
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   125
    [see also:]
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   126
        EditTextView CodeView Workspace
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   127
"
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   128
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   129
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   130
examples
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   131
"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   132
    although textViews (and instances of subclasses) are mostly used
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   133
    as components (in the fileBrowser, the browser, the launcher etc.),
5842
78747ab7d231 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5841
diff changeset
   134
    they may also be opened as a textEditor. Notice, that usually,
78747ab7d231 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5841
diff changeset
   135
    instances of one of my subclasses (EditTextView, TextCollector, Workspace)
78747ab7d231 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5841
diff changeset
   136
    are actually used.
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   137
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   138
    open a (readonly) textView on some information text:
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   139
                                                        [exBegin]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   140
        TextView
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   141
            openWith:'read this
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   142
and that,
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   143
and also this'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   144
            title:'demonstration'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   145
                                                        [exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   146
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   147
    the same, but open it modal:
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   148
                                                        [exBegin]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   149
        TextView
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   150
            openModalWith:'read this first'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   151
            title:'demonstration'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   152
                                                        [exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   153
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   154
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   155
    open it modal (but editable) on some text:
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   156
    (must accept before closing)
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   157
    This is somewhat kludgy - when closed, the view has already
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   158
    nilled its link to the model. Therefore, the accept must be
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   159
    done 'manually' below.
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   160
    However, usually an applicationModel is installed as the
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   161
    editor-topViews application. This would get a closeRequest,
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   162
    where it could handle things.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   163
                                                        [exBegin]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   164
        |m textView|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   165
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   166
        m := 'read this first' asValue.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   167
        textView := EditTextView openModalOnModel:m.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   168
        textView modified ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   169
            (self confirm:'text was not accepted - do it now ?')
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   170
            ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   171
                m value:textView contents
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   172
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   173
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   174
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   175
        Transcript showCR:m value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   176
                                                        [exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   177
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   178
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   179
    open a textEditor on some file:
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   180
                                                        [exBegin]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   181
        EditTextView openOn:'Makefile'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   182
                                                        [exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   183
5841
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   184
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   185
    configuring the TextView to NOT expand tabs and scan for special lines
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   186
    (to avoid reading all lines, when usig a virtualArray)
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   187
                                                        [exBegin]
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   188
        |a m|
5845
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   189
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   190
        a := VirtualArray new
5841
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   191
                setSize:100000000;
5845
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   192
                generator:[:lNr | Transcript show:'called for '; showCR:lNr.
5841
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   193
                                  'this is line: ',lNr printString ].
5845
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   194
        m := a asValue.
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   195
        (ScrollableView forView:TextView new)
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   196
            expandTabsWhenUpdating:false;
5841
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   197
            checkLineEndConventionWhenUpdating:false;
5845
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   198
            model:m;
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   199
            open; inspect.
5841
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   200
                                                        [exEnd]
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   201
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   202
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   203
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   204
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   205
!TextView class methodsFor:'instance creation'!
119
claus
parents: 97
diff changeset
   206
claus
parents: 97
diff changeset
   207
on:aModel aspect:aspect change:change menu:menu initialSelection:initial
claus
parents: 97
diff changeset
   208
    "for ST-80 compatibility"
claus
parents: 97
diff changeset
   209
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   210
    ^ (self new)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   211
        on:aModel
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   212
        aspect:aspect
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   213
        list:aspect
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   214
        change:change
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   215
        menu:menu
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   216
        initialSelection:initial
3280
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   217
!
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   218
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   219
with:someText
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   220
    ^ (self new)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   221
        contents:someText
119
claus
parents: 97
diff changeset
   222
! !
claus
parents: 97
diff changeset
   223
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   224
!TextView class methodsFor:'class initialization'!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   225
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   226
initialize
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   227
    DefaultParenthesisSpecification isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   228
        DefaultParenthesisSpecification := IdentityDictionary new.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   229
        DefaultParenthesisSpecification at:#open        put:#( $( $[ ${ "$> $<") .
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   230
        DefaultParenthesisSpecification at:#close       put:#( $) $] $} "$> $<").
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   231
        DefaultParenthesisSpecification at:#ignore      put:#( $' $" '$[' '$]' '${' '$)' ).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   232
        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
   233
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   234
! !
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   235
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   236
!TextView class methodsFor:'defaults'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
   237
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   238
defaultIcon
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   239
    "return the default icon if started as a topView"
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   240
3496
8c92a96c4e27 icon resource
Claus Gittinger <cg@exept.de>
parents: 3491
diff changeset
   241
    <resource: #programImage>
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   242
    <resource: #style (#ICON #ICON_FILE)>
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   243
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   244
    |nm i|
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   245
1146
027884518745 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   246
    i := self classResources at:'ICON' default:nil.
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   247
    i isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   248
        nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   249
        i := Smalltalk imageFromFileNamed:nm forClass:self.
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   250
    ].
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   251
    i notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   252
        i := i onDevice:Display
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   253
    ].
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   254
    ^ i
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   255
3496
8c92a96c4e27 icon resource
Claus Gittinger <cg@exept.de>
parents: 3491
diff changeset
   256
    "Modified: / 17-09-2007 / 11:36:29 / cg"
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   257
!
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   258
910
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   259
defaultMenuMessage
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   260
    "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
   261
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   262
    ^ #editMenu
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   263
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   264
    "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
   265
!
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   266
4254
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   267
defaultParenthesisSpecification
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   268
    ^ DefaultParenthesisSpecification
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   269
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   270
    "Created: / 14-06-2011 / 14:00:59 / cg"
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   271
!
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   272
2306
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   273
defaultSelectionBackgroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   274
    "return the default selection background color"
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   275
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   276
    ^DefaultSelectionBackgroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   277
!
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   278
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   279
defaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   280
    "return the default selection foreground color"
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   281
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   282
    ^DefaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   283
!
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   284
1477
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   285
defaultViewBackgroundColor
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   286
    "return the default view background"
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   287
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   288
    ^DefaultViewBackground
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   289
!
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   290
3226
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   291
lastSearchIgnoredCase
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   292
    ^ LastSearchIgnoredCase
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   293
!
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   294
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   295
lastSearchWasMatch
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   296
    ^ LastSearchWasMatch
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   297
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   298
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   299
st80SelectMode
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   300
    ^ UserPreferences current st80SelectMode
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   301
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   302
    "Modified: / 03-07-2006 / 16:26:44 / cg"
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   303
!
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   304
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   305
st80SelectMode:aBoolean
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   306
    UserPreferences current st80SelectMode:aBoolean
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   307
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   308
    "Created: / 07-01-1999 / 13:35:24 / cg"
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   309
    "Modified: / 03-07-2006 / 16:27:01 / cg"
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   310
!
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   311
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
   312
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   313
    "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
   314
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   315
    <resource: #style (#'textView.background'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   316
                       #'text.selectionForegroundColor'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   317
                       #'text.selectionBackgroundColor'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   318
                       #'text.alternativeSelectionForegroundColor'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   319
                       #'text.alternativeSelectionBackgroundColor'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   320
                       #'textView.font'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   321
                       #'text.wordSelectCatchesBlanks'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   322
                       #'text.st80Selections')>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   323
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   324
    DefaultViewBackground := StyleSheet colorAt:'textView.background' default:Color white.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   325
    DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   326
    DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'.
2630
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   327
"/    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
   328
"/    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
   329
    DefaultAlternativeSelectionForegroundColor := DefaultSelectionForegroundColor.
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   330
    DefaultAlternativeSelectionBackgroundColor := DefaultSelectionBackgroundColor.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   331
    DefaultFont := StyleSheet fontAt:'textView.font'.
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
   332
    MatchDelayTime := 0.6.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   333
    WordSelectCatchesBlanks := StyleSheet at:'text.wordSelectCatchesBlanks' default:false.
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   334
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   335
    "Modified: / 03-07-2006 / 16:29:42 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   336
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   337
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   338
!TextView class methodsFor:'help specs'!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   339
6256
76350fb3380f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   340
helpSpec
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   341
    "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
   342
     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
   343
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   344
    "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
   345
     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
   346
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   347
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   348
     UIHelpTool openOnClass:TextView
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   349
    "
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   350
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   351
    <resource: #help>
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   352
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   353
    ^ Dictionary new addPairsFrom:#(
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   354
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   355
#matchSearch
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   356
'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
   357
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   358
#searchCaseSensitive
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   359
'Care for case differences'
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   360
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   361
#searchFullWord
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   362
'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
   363
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   364
#searchAtBeginOfLineOnly
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   365
'Search only for the string at the beginning of a line'
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   366
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   367
#searchAtEndOfLineOnly
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   368
'Search only for the string at the end of a line'
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   369
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   370
#searchPattern
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   371
'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
   372
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   373
#searchVariable
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   374
'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
   375
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   376
#replaceText
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   377
'If checked, matching text is replaced by this'
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   378
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   379
#selectLines
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   380
'If checked, lines containing the matched string are selected.'
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   381
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   382
#replacePreserveCase
5727
59553507b326 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5726
diff changeset
   383
'Preserve the title case of replaced text'
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   384
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   385
#replaceAll
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   386
'Search and replace all occurrences of the searched string'
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   387
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   388
#searchWithWrap
5726
04a5c547c98f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5716
diff changeset
   389
'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
   390
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   391
#matchWithRegex
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   392
'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
   393
)
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   394
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   395
    "Modified: / 13-09-2018 / 10:03:15 / Claus Gittinger"
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   396
! !
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   397
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   398
!TextView class methodsFor:'interface specs'!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   399
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   400
searchDialogSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   401
    "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
   402
     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
   403
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   404
    "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
   405
     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
   406
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   407
    "
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   408
     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
   409
    "
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   410
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   411
    <resource: #canvas>
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   412
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   413
    ^ 
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   414
    #(FullSpec
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   415
       name: searchDialogSpec
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   416
       uuid: '218d9e60-b72e-11e8-aeef-b8f6b1108e05'
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   417
       window: 
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   418
      (WindowSpec
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   419
         label: 'String search'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   420
         name: 'String search'
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   421
         uuid: 'c93c164e-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   422
         min: (Point 10 10)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   423
         max: (Point 1280 1024)
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   424
         bounds: (Rectangle 0 0 551 407)
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   425
       )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   426
       component: 
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   427
      (SpecCollection
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   428
         collection: (
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   429
          (LabelSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   430
             label: 'SearchPattern:'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   431
             name: 'label'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   432
             layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   433
             uuid: 'c93c1a7c-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   434
             level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   435
             translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   436
             adjust: left
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   437
           )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   438
          (ComboBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   439
             name: 'patternComboBox'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   440
             layout: (LayoutFrame 2 0.0 26 0 -2 1.0 48 0)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   441
             activeHelpKey: searchPattern
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   442
             uuid: 'c93c1d38-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   443
             tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   444
             model: searchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   445
             immediateAccept: false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   446
             acceptOnLeave: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   447
             acceptOnReturn: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   448
             acceptOnTab: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   449
             acceptOnLostFocus: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   450
             acceptOnPointerLeave: false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   451
             autoSelectInitialText: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   452
             comboList: patternList
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   453
           )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   454
          (VerticalPanelViewSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   455
             name: 'VerticalPanel1'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   456
             layout: (LayoutFrame 0 0.0 52 0 0 1.0 -32 1)
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   457
             uuid: 'c93c21e8-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   458
             horizontalLayout: fit
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   459
             verticalLayout: top
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   460
             component: 
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   461
            (SpecCollection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   462
               collection: (
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   463
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   464
                   label: 'Case Sensitive'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   465
                   name: 'ignoreCaseCheckBox'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   466
                   activeHelpKey: searchCaseSensitive
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   467
                   uuid: 'c93c242c-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   468
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   469
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   470
                   model: caseSensitive
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   471
                   translateLabel: true
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   472
                   extent: (Point 551 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   473
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   474
                (ViewSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   475
                   name: 'MatchBox'
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   476
                   uuid: 'c93c2620-8698-11e8-80e0-b8f6b1108e05'
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   477
                   component: 
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   478
                  (SpecCollection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   479
                     collection: (
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   480
                      (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   481
                         label: 'Match (forward only)'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   482
                         name: 'matchCheckBox'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   483
                         layout: (LayoutFrame 0 0 0 0 260 0 0 1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   484
                         activeHelpKey: matchSearch
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   485
                         uuid: 'c93c272e-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   486
                         level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   487
                         tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   488
                         model: match
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   489
                         translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   490
                       )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   491
                      (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   492
                         label: 'Regex Match'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   493
                         name: 'CheckBox6'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   494
                         layout: (LayoutFrame -170 1 0 0 0 1 22 0)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   495
                         activeHelpKey: matchWithRegex
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   496
                         uuid: 'c93c285a-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   497
                         enableChannel: matchWithRegexVisible
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   498
                         model: matchWithRegex
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   499
                         translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   500
                       )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   501
                      )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   502
                    
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   503
                   )
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   504
                   extent: (Point 551 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   505
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   506
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   507
                   label: 'Search Full Words'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   508
                   name: 'CheckBox2'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   509
                   activeHelpKey: searchFullWord
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   510
                   uuid: 'c93c29ae-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   511
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   512
                   enableChannel: searchFullWordEnabled
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   513
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   514
                   model: searchFullWord
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   515
                   translateLabel: true
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   516
                   extent: (Point 551 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   517
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   518
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   519
                   label: 'At Begin of Line Only'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   520
                   name: 'CheckBox5'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   521
                   activeHelpKey: searchAtBeginOfLineOnly
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   522
                   uuid: 'c93c2ac6-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   523
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   524
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   525
                   model: searchAtBeginOfLineOnly
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   526
                   translateLabel: true
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   527
                   extent: (Point 551 24)
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   528
                 )
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   529
                (CheckBoxSpec
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   530
                   label: 'At End of Line Only'
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   531
                   name: 'CheckBox7'
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   532
                   activeHelpKey: searchAtEndOfLineOnly
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   533
                   uuid: 'c93c2ac6-8698-11e8-80e0-b8f6b1108e05'
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   534
                   level: 0
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   535
                   enableChannel: atEndOfLineOnlyEnabled
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   536
                   tabable: true
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   537
                   model: searchAtEndOfLineOnly
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   538
                   translateLabel: true
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   539
                   extent: (Point 551 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   540
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   541
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   542
                   label: 'Variable Only'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   543
                   name: 'CheckBox1'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   544
                   activeHelpKey: searchVariable
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   545
                   uuid: 'c93c2bde-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   546
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   547
                   visibilityChannel: searchVariableVisible
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   548
                   enableChannel: searchVariableEnabled
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   549
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   550
                   model: searchVariable
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   551
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   552
                   labelChannel: stringWithVariableUnderCursorHolder
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   553
                   extent: (Point 551 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   554
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   555
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   556
                   label: 'Select Lines'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   557
                   name: 'CheckBox3'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   558
                   activeHelpKey: selectLines
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   559
                   uuid: 'c93c2d0a-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   560
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   561
                   initiallyInvisible: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   562
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   563
                   model: selectLinesHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   564
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   565
                   extent: (Point 429 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   566
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   567
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   568
                   label: 'Wrap at End of Text (forward only)'
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   569
                   name: 'CheckBox8'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   570
                   activeHelpKey: searchWithWrap
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   571
                   uuid: 'c93c2e2c-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   572
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   573
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   574
                   model: wrapAtEndOfTextHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   575
                   translateLabel: true
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   576
                   extent: (Point 551 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   577
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   578
                (ViewSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   579
                   name: 'Box1'
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   580
                   uuid: 'c93c2f44-8698-11e8-80e0-b8f6b1108e05'
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   581
                   extent: (Point 551 10)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   582
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   583
                (HorizontalPanelViewSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   584
                   name: 'HorizontalPanel1'
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   585
                   uuid: 'c93c3016-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   586
                   horizontalLayout: leftFit
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   587
                   verticalLayout: fit
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   588
                   ignoreInvisibleComponents: false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   589
                   elementsChangeSize: true
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   590
                   component: 
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   591
                  (SpecCollection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   592
                     collection: (
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   593
                      (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   594
                         label: 'Replace By:'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   595
                         name: 'CheckBox4'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   596
                         activeHelpKey: replaceText
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   597
                         uuid: 'c93c3192-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   598
                         level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   599
                         enableChannel: replaceEnabled
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   600
                         tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   601
                         model: replaceBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   602
                         translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   603
                         resizeForLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   604
                         useDefaultExtent: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   605
                       )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   606
                      (InputFieldSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   607
                         name: 'ReplaceEntryField'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   608
                         activeHelpKey: replaceText
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   609
                         uuid: 'c93c32f0-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   610
                         visibilityChannel: replaceBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   611
                         enableChannel: replaceBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   612
                         model: replaceTextHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   613
                         acceptOnReturn: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   614
                         acceptOnTab: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   615
                         acceptOnPointerLeave: true
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   616
                         extent: (Point 416 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   617
                       )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   618
                      )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   619
                    
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   620
                   )
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   621
                   extent: (Point 551 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   622
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   623
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   624
                   label: '  Replace All (to End of Text)'
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   625
                   name: 'CheckBox9'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   626
                   activeHelpKey: replaceAll
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   627
                   uuid: 'c93c353e-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   628
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   629
                   enableChannel: replaceBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   630
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   631
                   model: replaceAllBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   632
                   translateLabel: true
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   633
                   extent: (Point 551 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   634
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   635
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   636
                   label: '  Preserve Case'
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   637
                   name: 'CheckBox10'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   638
                   activeHelpKey: replacePreserveCase
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   639
                   uuid: 'c93c366a-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   640
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   641
                   enableChannel: replaceBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   642
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   643
                   model: replacePreserveCaseBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   644
                   translateLabel: true
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   645
                   extent: (Point 551 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   646
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   647
                )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   648
              
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   649
             )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   650
           )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   651
          (HorizontalPanelViewSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   652
             name: 'horizontalPanelView'
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   653
             layout: (LayoutFrame 20 0.0 -38 1.0 -30 1.0 -2 1.0)
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   654
             uuid: 'c93c3908-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   655
             level: 0
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   656
             horizontalLayout: leftSpace
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   657
             verticalLayout: center
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   658
             horizontalSpace: 3
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   659
             verticalSpace: 3
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   660
             ignoreInvisibleComponents: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   661
             reverseOrderIfOKAtLeft: true
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   662
             component: 
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   663
            (SpecCollection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   664
               collection: (
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   665
                (ActionButtonSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   666
                   label: 'Cancel'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   667
                   name: 'cancelButton'
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   668
                   uuid: 'c93c3b74-8698-11e8-80e0-b8f6b1108e05'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   669
                   level: 2
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   670
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   671
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   672
                   model: cancel
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   673
                   extent: (Point 85 36)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   674
                 )
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   675
                (ViewSpec
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   676
                   name: 'Box2'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   677
                   uuid: 'db91ecb4-8699-11e8-80e0-b8f6b1108e05'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   678
                   extent: (Point 80 30)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   679
                 )
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   680
                (HorizontalPanelViewSpec
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   681
                   name: 'HorizontalPanel2'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   682
                   uuid: 'c93c3908-8698-11e8-80e0-b8f6b1108e05'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   683
                   level: 0
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   684
                   horizontalLayout: fitSpace
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   685
                   verticalLayout: center
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   686
                   horizontalSpace: 3
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   687
                   verticalSpace: 3
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   688
                   ignoreInvisibleComponents: true
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   689
                   component: 
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   690
                  (SpecCollection
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   691
                     collection: (
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   692
                      (ActionButtonSpec
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   693
                         label: 'Prev'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   694
                         name: 'prevButton'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   695
                         uuid: 'c93c3e6c-8698-11e8-80e0-b8f6b1108e05'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   696
                         level: 2
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   697
                         translateLabel: true
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   698
                         tabable: true
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   699
                         model: prevAction
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   700
                         useDefaultExtent: true
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   701
                       )
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   702
                      (ActionButtonSpec
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   703
                         label: 'Next'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   704
                         name: 'nextButton'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   705
                         uuid: 'c93c3ffc-8698-11e8-80e0-b8f6b1108e05'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   706
                         level: 2
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   707
                         borderWidth: 1
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   708
                         translateLabel: true
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   709
                         tabable: true
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   710
                         model: nextAction
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   711
                         isDefault: true
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   712
                         defaultable: true
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   713
                         extent: (Point 101 36)
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   714
                       )
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   715
                      (ActionButtonSpec
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   716
                         label: 'Last'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   717
                         name: 'lastButton'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   718
                         uuid: 'db91f074-8699-11e8-80e0-b8f6b1108e05'
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   719
                         level: 2
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   720
                         borderWidth: 1
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   721
                         translateLabel: true
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   722
                         tabable: true
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   723
                         model: lastAction
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   724
                         useDefaultExtent: true
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   725
                       )
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   726
                      )
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   727
                    
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
   728
                   )
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
   729
                   extent: (Point 320 36)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   730
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   731
                )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   732
              
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   733
             )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   734
             keepSpaceForOSXResizeHandleH: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   735
           )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   736
          )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   737
        
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   738
       )
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   739
     )
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   740
! !
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   741
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   742
!TextView class methodsFor:'startup'!
121
claus
parents: 120
diff changeset
   743
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   744
open
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   745
    "start an empty TextView"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   746
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   747
    ^ self openWith:nil
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   748
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   749
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   750
openModalOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   751
    "start a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   752
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   753
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   754
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   755
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   756
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   757
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   758
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   759
    "Created: 14.2.1997 / 15:24:12 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   760
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   761
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   762
openModalWith:aString
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   763
    "start a textView with aString as initial contents"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   764
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   765
    ^ self openModalWith:aString title:nil
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   766
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   767
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   768
     TextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   769
     EditTextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   770
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   771
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   772
    "Created: 14.2.1997 / 15:19:04 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   773
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   774
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   775
openModalWith:aString title:aTitle
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   776
    "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
   777
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   778
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   779
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   780
    textView := self setupWith:aString title:aTitle.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   781
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   782
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   783
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   784
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   785
     TextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   786
     EditTextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   787
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   788
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   789
    "Modified: 9.9.1996 / 19:32:29 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   790
    "Created: 14.2.1997 / 15:19:18 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   791
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   792
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   793
openOn:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   794
    "start a textView on a file; return the textView"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   795
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   796
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   797
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   798
    textView := self setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   799
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   800
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   801
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   802
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   803
     TextView openOn:'../../doc/overview.doc'
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   804
     EditTextView openOn:'../../doc/overview.doc'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   805
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   806
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   807
    "Modified: 14.2.1997 / 15:21:51 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   808
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   809
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   810
openOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   811
    "start a textView on a model; return the textView"
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
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   814
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   815
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   816
    textView topView open.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   817
    ^ textView
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
    "Created: 14.2.1997 / 15:23:36 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   820
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   821
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   822
openWith:aStringOrStringCollection
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   823
    "start a textView with aStringOrStringCollection as initial contents"
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   824
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   825
    ^ self openWith:aStringOrStringCollection selected:false
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   826
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   827
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   828
     TextView openWith:'some text'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   829
     EditTextView openWith:'some text'
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
   830
     Workspace openWith:'some text'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   831
    "
119
claus
parents: 97
diff changeset
   832
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   833
    "Created: 10.12.1995 / 17:41:32 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   834
    "Modified: 5.3.1997 / 15:37:19 / cg"
126
claus
parents: 121
diff changeset
   835
!
claus
parents: 121
diff changeset
   836
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   837
openWith:aStringOrStringCollection selected:selectedBoolean
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   838
    "start a textView with aStringOrStringCollection as initial (optionally selected) contents.
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   839
     Return the textView."
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   840
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   841
    |textView|
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   842
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   843
    textView := self setupEmpty.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   844
    textView contents:aStringOrStringCollection selected:selectedBoolean.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   845
    textView topView open.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   846
    ^ textView
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   847
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   848
    "
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   849
     TextView openWith:'some text' selected:true
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   850
     EditTextView openWith:'some text' selected:false
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   851
    "
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   852
!
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   853
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   854
openWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   855
    "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
   856
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   857
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   858
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   859
    textView := self setupWith:aStringOrStringCollection title:aTitle.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   860
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   861
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   862
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   863
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   864
     TextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   865
     EditTextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   866
    "
126
claus
parents: 121
diff changeset
   867
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   868
    "Created: 10.12.1995 / 17:40:02 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   869
    "Modified: 5.3.1997 / 15:37:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   870
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   871
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   872
setupEmpty
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   873
    "create a textview in a topview, with horizontal and
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   874
     vertical scrollbars - a helper for #startWith: and #startOn:"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   875
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   876
    |top frame label|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   877
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   878
    label := 'unnamed'.
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   879
    top := StandardSystemView label:label icon:self defaultIcon.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   880
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   881
    frame := HVScrollableView
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   882
                for:self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   883
                miniScrollerH:true miniScrollerV:false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   884
                in:top.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   885
    frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   886
    ^ frame scrolledView
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   887
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   888
    "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
   889
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   890
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   891
setupForFile:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   892
    "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
   893
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   894
    |textView|
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   895
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   896
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   897
    aFileName notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   898
        textView setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   899
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   900
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   901
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   902
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
   903
    "Created: / 14-02-1997 / 15:21:43 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
   904
    "Modified: / 25-10-2006 / 14:46:54 / cg"
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   905
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   906
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   907
setupForModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   908
    "setup a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   909
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   910
    |textView|
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   911
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   912
    textView := self setupEmpty.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   913
    textView model:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   914
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   915
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   916
    "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
   917
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   918
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   919
setupWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   920
    "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
   921
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   922
    |top textView|
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   923
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   924
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   925
    top := textView topView.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   926
    aTitle notNil ifTrue:[top label:aTitle].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   927
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   928
    aStringOrStringCollection notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   929
        textView contents:aStringOrStringCollection
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   930
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   931
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   932
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   933
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   934
    "Created: 9.9.1996 / 19:31:22 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   935
    "Modified: 5.3.1997 / 15:37:37 / cg"
119
claus
parents: 97
diff changeset
   936
! !
claus
parents: 97
diff changeset
   937
2744
cb920467a4b4 method category rename
Claus Gittinger <cg@exept.de>
parents: 2740
diff changeset
   938
!TextView methodsFor:'Compatibility-ST80'!
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   939
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   940
displaySelection:aBoolean
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   941
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   942
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   943
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   944
2118
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   945
editText:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   946
    "ST-80 compatibility: set the edited text."
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   947
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   948
    self contents:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   949
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   950
    "Created: / 5.2.2000 / 17:06:18 / cg"
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   951
!
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   952
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   953
selectAndScroll
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   954
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   955
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   956
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   957
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   958
selectFrom:startPos to:endPos
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   959
    "change the selection given two character positions."
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   960
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   961
    self selectFromCharacterPosition:startPos to:endPos
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   962
!
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   963
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   964
selectionStartIndex
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   965
    "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
   966
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   967
    ^ self characterPositionOfSelection
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   968
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   969
    "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
   970
!
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   971
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   972
selectionStopIndex
2052
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   973
    "ST-80 compatibility: return the character position of
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   974
     the character right after the selection."
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   975
2109
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   976
    |idx|
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   977
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   978
    idx := self characterPositionOfSelectionEnd.
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   979
    idx == 0 ifTrue:[^ 0].
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   980
    ^ idx + 1
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   981
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   982
    "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
   983
! !
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   984
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   985
!TextView methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   986
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   987
characterPositionOfSelection
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   988
    "return the character index of the first character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   989
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   990
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
   991
    |startLine|
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
   992
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
   993
    (startLine := self selectionStartLine) isNil ifTrue:[^ 0].
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
   994
    ^ self characterPositionOfLine:startLine col:(self selectionStartCol)
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   995
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   996
    "Modified: 14.8.1997 / 16:35:37 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   997
!
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   998
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   999
characterPositionOfSelectionEnd
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  1000
    "return the character index of the last character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  1001
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  1002
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  1003
    self selectionStartLine isNil ifTrue:[^ 0]. "/ no selection
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  1004
    ^ self characterPositionOfLine:self selectionEndLine col:self selectionEndCol
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  1005
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  1006
    "Created: 14.8.1997 / 16:35:24 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  1007
    "Modified: 14.8.1997 / 16:35:45 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1008
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1009
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1010
contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1011
    "return true, if the contents was saved (by a save action),
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1012
     false if not (or was modified again after the last save)."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1013
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1014
    ^ contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1015
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1016
3214
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
  1017
contentsWasSaved:aBoolean
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
  1018
    contentsWasSaved := aBoolean
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
  1019
!
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
  1020
3212
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
  1021
defaultFileNameForFileDialog
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
  1022
    "return the default fileName to use for the save-box"
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
  1023
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1024
    ^ defaultFileNameForFileDialog
3212
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
  1025
!
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
  1026
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1027
defaultFileNameForFileDialog:aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1028
    "define the default fileName to use for the save-box"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1029
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1030
    defaultFileNameForFileDialog := aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1031
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1032
    "Created: 13.2.1997 / 18:29:53 / cg"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1033
!
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1034
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1035
directoryForFileDialog:aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1036
    "define the default directory to use for save-box"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1037
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1038
    directoryForFileDialog := aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1039
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1040
    "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
  1041
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1042
2941
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
  1043
externalEncoding
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
  1044
    "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
  1045
     This is (currently only) passed down from the fileBrowser,
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
  1046
     and required when  utf8/japanese/chinese/korean text is edited.
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
  1047
     (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
  1048
     Notice: this only affects the external representation of the text."
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
  1049
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
  1050
    ^ externalEncoding
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
  1051
!
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
  1052
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1053
externalEncoding:encodingSymOrNil
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1054
    "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
  1055
     via the 'save / save as' dialog.
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1056
     This is (currently only) passed down from the fileBrowser,
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1057
     and required when  utf8/japanese/chinese/korean text is edited.
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1058
     (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
  1059
     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
  1060
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1061
    externalEncoding := encodingSymOrNil
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1062
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1063
2581
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
  1064
parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
  1065
    "return the value of the instance variable 'parenthesisSpecification' (automatically generated)"
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
  1066
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
  1067
    ^ parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
  1068
!
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
  1069
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1070
parenthesisSpecification:aDictionary
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1071
    "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
  1072
     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
  1073
     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
  1074
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1075
    parenthesisSpecification := aDictionary
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1076
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1077
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1078
saveAction:something
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1079
    saveAction := something.
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  1080
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  1081
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  1082
searchBarActionBlock
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  1083
    ^ searchBarActionBlock
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  1084
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  1085
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  1086
searchBarActionBlock:something
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  1087
    searchBarActionBlock := something.
5848
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1088
!
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1089
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1090
textView
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1091
    "added to allow sending textView in any context, where either
5923
608f60d667fa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  1092
     a TextView or a CodeView2 can be encountered. 
608f60d667fa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  1093
     Sigh - all of this because CodeView2 wraps a textView, and does not forward
608f60d667fa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  1094
     all messages. 
608f60d667fa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  1095
     Thus, the codeView2 framework always sends codeView2 textView doSomething"
5848
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1096
     
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1097
    ^ self
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1098
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1099
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1100
!TextView methodsFor:'accessing-contents'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1101
2791
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1102
contents:newContents selected:selectedBoolean
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1103
    self contents:newContents.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1104
    selectedBoolean ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1105
        list size == 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1106
            self selectFromLine:1 col:1 toLine:1 col:(list at:1) size
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1107
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1108
            self selectAll
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1109
        ]
2791
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1110
    ]
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1111
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1112
    "
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1113
     |w|
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1114
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1115
     w := Workspace new open.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1116
     w contents:'Hello world' selected:true.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1117
    "
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1118
!
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1119
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1120
fromFile:aFileName
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1121
    "take contents from a named file"
3724
5db1580f82ba mark obsolete message
Stefan Vogel <sv@exept.de>
parents: 3708
diff changeset
  1122
    <resource: #obsolete>
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1123
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1124
    self obsoleteMethodWarning.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1125
    ^ self loadTextFile:aFileName.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1126
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1127
    "Modified: / 25-10-2006 / 14:47:35 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1128
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1129
4755
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1130
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1131
    "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
  1132
     Redefined since changing the contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1133
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1134
    self unselect.
4755
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1135
    super list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1136
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1137
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1138
loadTextFile:aFileName
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1139
    "take contents from a named file"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1140
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1141
    |f|
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1142
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1143
    f := aFileName asFilename.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1144
    self directoryForFileDialog:(f directoryName).
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1145
    self contents:(f contents)
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1146
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1147
    "Created: / 25-10-2006 / 14:44:01 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1148
!
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1149
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1150
setContents:something
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  1151
    "set the contents (either a string or a collection of strings).
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  1152
     Does not change the position (i.e. does not scroll) 
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  1153
     and (tries to) keep the selection."
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1154
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1155
    |selStartLine selStartCol selEndLine selEndCol selStyle|
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1156
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  1157
    selStartLine := self selectionStartLine.
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  1158
    selStartCol := self selectionStartCol.
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  1159
    selEndLine := self selectionEndLine.
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  1160
    selEndCol := self selectionEndCol.
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1161
    selStyle := selectStyle.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1162
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1163
    super setContents:something.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1164
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1165
    selStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1166
        self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1167
            selectFromLine:selStartLine col:selStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1168
            toLine:selEndLine col:selEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1169
        selectStyle := selStyle
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1170
    ].
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1171
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1172
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1173
    "Modified: / 31.3.1998 / 23:33:21 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1174
!
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1175
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1176
setList:something
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1177
    "set the displayed contents (a collection of strings)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1178
     without redraw.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1179
     Redefined since changing contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1180
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1181
    self unselect.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1182
    super setList:something
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1183
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1184
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1185
setupForFile:aFileName
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1186
    "take contents from a named file"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1187
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1188
    |baseName|
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1189
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1190
    self loadTextFile:aFileName.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1191
    aFileName notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1192
        baseName := aFileName asFilename baseName.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1193
        self topView label:baseName.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1194
        self defaultFileNameForFileDialog:baseName.
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1195
    ].
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1196
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1197
    "Created: / 25-10-2006 / 14:47:13 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1198
!
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1199
1487
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1200
text
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1201
    "for ST80 compatibility"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1202
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1203
    ^ self contents
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1204
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1205
    "Created: / 19.4.1998 / 12:53:10 / cg"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1206
!
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1207
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1208
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
  1209
    "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
  1210
     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
  1211
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1212
    |beginCol endCol endLine thisCharacter flag|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1213
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1214
    flag := #word.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1215
    beginCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1216
    endCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1217
    endLine := selectLine.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1218
    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
  1219
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1220
    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
  1221
    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
  1222
    endCol == 0 ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1223
        endLine := selectLine + 1
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1224
    ].
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1225
1750
d87cc464fde2 comment
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1226
    "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
  1227
    (wordCheck value:thisCharacter) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1228
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1229
         try to catch a blank ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1230
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1231
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1232
        WordSelectCatchesBlanks ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1233
            ((beginCol == 1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1234
            or:[(self characterAtLine:selectLine col:(beginCol - 1))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1235
                 ~~ Character space]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1236
                ((self characterAtLine:selectLine col:(endCol + 1))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1237
                  == Character space) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1238
                    endCol := endCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1239
                    flag := #wordRight
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1240
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1241
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1242
                beginCol := beginCol - 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1243
                flag := #wordLeft
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1244
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1245
        ].
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1246
    ].
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1247
    aFiveArgBlock value:selectLine
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1248
                  value:beginCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1249
                  value:endLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1250
                  value:endCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1251
                  value:flag
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1252
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1253
    "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
  1254
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1255
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1256
!TextView methodsFor:'accessing-look'!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1257
2027
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1258
selectionBackgroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1259
    "return the selection-background color."
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1260
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1261
    ^ selectionBgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1262
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1263
5847
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1264
selectionBackgroundColor:aColor
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1265
    "set the selection-background color.
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1266
     The default is defined by the styleSheet;
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1267
     typically black-on-green for color displays and white-on-black for b&w displays."
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1268
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1269
    selectionBgColor := aColor onDevice:device.
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1270
    self hasSelection ifTrue:[
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1271
        self invalidate
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1272
    ]
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1273
!
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1274
2027
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1275
selectionForegroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1276
    "return the selection-foreground color."
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1277
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1278
    ^ selectionFgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1279
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1280
5847
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1281
selectionForegroundColor:aColor
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1282
    "set the selection-foreground color.
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1283
     The default is defined by the styleSheet;
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1284
     typically black-on-green for color displays and white-on-black for b&w displays."
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1285
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1286
    selectionFgColor := aColor onDevice:device.
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1287
    self hasSelection ifTrue:[
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1288
        self invalidate
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1289
    ]
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1290
!
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1291
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1292
selectionForegroundColor:color1 backgroundColor:color2
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1293
    "set both the selection-foreground and cursor background colors.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1294
     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
  1295
     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
  1296
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1297
    selectionFgColor := color1 onDevice:device.
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1298
    selectionBgColor := color2 onDevice:device.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2900
diff changeset
  1299
    self hasSelection ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1300
        self invalidate
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1301
    ]
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1302
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 715
diff changeset
  1303
    "Modified: 29.5.1996 / 16:22:15 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1304
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1305
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1306
!TextView methodsFor:'accessing-mvc'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1307
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1308
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
  1309
    "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
  1310
     and selection. Added for ST-80 compatibility"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1311
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1312
    aspectSym notNil ifTrue:[aspectMsg := aspectSym.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1313
                             listMsg isNil ifTrue:[listMsg := aspectSym]].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1314
    changeSym notNil ifTrue:[changeMsg := changeSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1315
    listSym notNil ifTrue:[listMsg := listSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1316
    menuSym notNil ifTrue:[menuMsg := menuSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1317
"/    initial notNil ifTrue:[initialSelectionMsg := initial].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1318
    self model:aModel.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1319
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1320
    "Modified: 15.8.1996 / 12:52:54 / stefan"
906
a8b9b481ce70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1321
    "Modified: 2.1.1997 / 16:11:28 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1322
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1323
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1324
!TextView methodsFor:'drag & drop'!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1325
96256221e3af support drag
ca
parents: 2581
diff changeset
  1326
allowDrag:aBoolean
96256221e3af support drag
ca
parents: 2581
diff changeset
  1327
    "enable/disable dragging support
96256221e3af support drag
ca
parents: 2581
diff changeset
  1328
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  1329
    aBoolean ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1330
        dropSource := nil.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1331
    ] ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1332
        dropSource isNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1333
            dropSource := DropSource
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1334
                            receiver:self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1335
                            argument:nil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1336
                            dropObjectSelector:#collectionOfDragObjects
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1337
                            displayObjectSelector:nil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1338
        ]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1339
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  1340
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1341
96256221e3af support drag
ca
parents: 2581
diff changeset
  1342
canDrag
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1343
    "returns true if dragging is enabled"
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1344
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1345
    ^ dropSource notNil and:[ self hasSelection ]
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1346
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1347
    "Modified (comment): / 12-02-2012 / 08:37:21 / cg"
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1348
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1349
96256221e3af support drag
ca
parents: 2581
diff changeset
  1350
collectionOfDragObjects
96256221e3af support drag
ca
parents: 2581
diff changeset
  1351
    "returns collection of dragable objects assigned to selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  1352
     Here, by default, a collection of text-dragObjects is generated;
96256221e3af support drag
ca
parents: 2581
diff changeset
  1353
     however, if a dragObjectConverter is defined, that one gets a chance
96256221e3af support drag
ca
parents: 2581
diff changeset
  1354
     to convert as appropriate.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1355
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  1356
    |selection|
96256221e3af support drag
ca
parents: 2581
diff changeset
  1357
96256221e3af support drag
ca
parents: 2581
diff changeset
  1358
    selection := self selection.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1359
96256221e3af support drag
ca
parents: 2581
diff changeset
  1360
    selection size == 0 ifTrue:[^ nil].
5249
cc785134a690 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1361
    ^ Array with:(DropObject newText:selection).
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1362
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1363
96256221e3af support drag
ca
parents: 2581
diff changeset
  1364
dropSource
3245
b17c15b61e94 ugly comments
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  1365
    "returns the dropSource or nil"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1366
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1367
    ^ dropSource
96256221e3af support drag
ca
parents: 2581
diff changeset
  1368
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1369
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1370
dropSource:aDropSourceOrNil
3245
b17c15b61e94 ugly comments
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  1371
    "set the dropSource or nil"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1372
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1373
    dropSource := aDropSourceOrNil.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1374
! !
96256221e3af support drag
ca
parents: 2581
diff changeset
  1375
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1376
!TextView methodsFor:'encoding'!
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1377
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1378
validateFontEncodingFor:newEncoding ask:ask
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1379
    "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
  1380
     which is able to display text encoded as specified by newEncoding"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1381
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1382
    |fontsEncoding msg filter f defaultFont pref matchingFonts
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1383
     matchingFamilyFonts matchingFamilyFaceFonts matchingFamilyFaceStyleFonts
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1384
     matchingFamilyFaceStyleSizeFonts font|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1385
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1386
    font := gc font.
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1387
    fontsEncoding := font encoding.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1388
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1389
    pref := FontDescription preferredFontEncodingFor:newEncoding.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1390
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1391
    (pref match:fontsEncoding) ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1392
        ^ self
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1393
    ].
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1394
    (fontsEncoding notNil and:[CharacterEncoder isEncoding:pref subSetOf:fontsEncoding]) ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1395
        ^ self
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1396
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1397
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1398
    filter := [:f | |coding|
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1399
                    (coding := f encoding) notNil
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1400
                    and:[pref match:coding]].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1401
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1402
    device flushListOfAvailableFonts.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1403
    matchingFonts := device listOfAvailableFonts select:filter.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1404
    matchingFamilyFonts := matchingFonts select:[:f | f family = font family].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1405
    matchingFamilyFaceFonts := matchingFamilyFonts select:[:f | f face = font face].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1406
    matchingFamilyFaceStyleFonts := matchingFamilyFaceFonts select:[:f | f style = font style].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1407
    matchingFamilyFaceStyleSizeFonts := matchingFamilyFaceStyleFonts select:[:f | f size = font size].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1408
    matchingFamilyFaceStyleSizeFonts size > 0 ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1409
        defaultFont := matchingFamilyFaceStyleSizeFonts first
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1410
    ] ifFalse:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1411
        matchingFamilyFaceStyleFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1412
            defaultFont := matchingFamilyFaceStyleFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1413
        ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1414
            matchingFamilyFaceFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1415
                defaultFont := matchingFamilyFaceFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1416
            ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1417
                matchingFamilyFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1418
                    defaultFont := matchingFamilyFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1419
                ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1420
                    matchingFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1421
                        defaultFont := matchingFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1422
                    ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1423
                ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1424
            ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1425
        ].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1426
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1427
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1428
    defaultFont isNil ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1429
        defaultFont isNil ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1430
            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
  1431
            pref := #'iso10646-1'.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1432
        ]
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1433
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1434
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1435
    msg := 'Switch to a %1 encoded font ?'.
3189
945a221e5cb2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3045
diff changeset
  1436
    (ask not or:[self confirm:(resources stringWithCRs:msg with:pref)])
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1437
    ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1438
        self withWaitCursorDo:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1439
            f := FontPanel
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1440
                    fontFromUserInitial:defaultFont
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1441
                    title:(resources string:'Font selection')
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1442
                    filter:filter
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1443
                    encoding:pref.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1444
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1445
            f notNil ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1446
                self font:f.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1447
            ]
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1448
        ]
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1449
    ]
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1450
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1451
    "Created: 26.10.1996 / 12:06:54 / cg"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1452
    "Modified: 30.6.1997 / 17:46:46 / cg"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1453
! !
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1454
2752
5650a9ab5935 method category rename
Claus Gittinger <cg@exept.de>
parents: 2744
diff changeset
  1455
!TextView methodsFor:'event handling'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1456
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1457
buttonMotion:buttonState x:x y:y
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1458
    "mouse-move while button was pressed - handle selection changes"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1459
3219
e8c7679a8a94 buttonrelease behavior, when released in another view
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
  1460
    (clickLine isNil or:[clickPos isNil]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1461
        dragIsActive := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1462
        ^ self
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1463
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  1464
96256221e3af support drag
ca
parents: 2581
diff changeset
  1465
    dragIsActive ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1466
        (clickPos dist:(x@y)) >= 5.0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1467
            dragIsActive := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1468
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1469
            self hasSelection ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1470
                dropSource startDragIn:self at:(x@y)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1471
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1472
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1473
        ^ self
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1474
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1475
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1476
    "is it the select or 1-button ?"
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1477
    buttonState == 0 ifTrue:[^ self].
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1478
    self sensor leftButtonPressed ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1479
        "/ self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1480
        "/ self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1481
        ^ self
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1482
    ].
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1483
"/    (device buttonMotionMask:buttonState includesButton:#select) ifFalse:[
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1484
"/        (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
  1485
"/            ^ self
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1486
"/        ].
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1487
"/    ].
53
b587b15eafab *** empty log message ***
claus
parents: 45
diff changeset
  1488
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1489
    "if moved outside of view, start autoscroll"
3202
8217b0acc9f2 select from beginning (in editField
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
  1490
4160
a9c329c2784d changed: buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 4156
diff changeset
  1491
    ((y < 0) and:[firstLineShown ~~ 0]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1492
        self compressMotionEvents:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1493
        (self startAutoScrollUp:y negated) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1494
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1495
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1496
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1497
    (y > height) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1498
        self compressMotionEvents:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1499
        (self startAutoScrollDown:(y - height)) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1500
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1501
        ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1502
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  1503
    ((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1504
        self compressMotionEvents:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1505
        (self startAutoScrollLeft:x) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1506
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1507
        ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1508
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1509
    (x > width) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1510
        self compressMotionEvents:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1511
        (self startAutoScrollRight:(x - width)) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1512
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1513
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1514
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1515
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1516
    "move inside - stop autoscroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1517
    autoScrollBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1518
        self stopScrollSelect
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1519
    ].
3220
246c5a3bfefa oops - leftover prints
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
  1520
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1521
    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
  1522
4160
a9c329c2784d changed: buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 4156
diff changeset
  1523
    "Modified: / 08-08-2010 / 11:20:54 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1524
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1525
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1526
buttonMultiPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1527
    "multi-mouse-click - select word under pointer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1528
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1529
    (button == 1) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1530
        clickPos := x @ y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1531
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1532
        "/ 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
  1533
"/        self clearSearchAction.
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  1534
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1535
        clickCount notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1536
            clickCount := clickCount + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1537
            (clickCount == 2) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1538
                self doubleClickX:x y:y
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1539
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1540
                (clickCount == 3) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1541
                    self tripleClickX:x y:y
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1542
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1543
                    (clickCount == 4) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1544
                        self quadClickX:x y:y
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1545
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1546
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1547
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1548
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1549
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1550
        super buttonMultiPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1551
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1552
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1553
    "Modified: 11.9.1997 / 04:15:35 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1554
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1555
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1556
buttonPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1557
    "mouse-click - prepare for selection change"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1558
1308
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1559
    |sensor clickVisibleLine|
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1560
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1561
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1562
    sensor       := self sensor.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1563
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1564
    (button == 1) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1565
        sensor shiftDown ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1566
            "mouse-click with shift - adding to selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1567
            self extendSelectionToX:x y:y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1568
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1569
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1570
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1571
        clickVisibleLine := self visibleLineOfY:y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1572
        clickPos := x @ y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1573
        clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1574
        clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1575
        clickStartLine := clickLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1576
        clickStartCol := clickCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1577
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1578
        (self canDrag
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1579
        and:[(self isInSelection:clickLine col:clickCol)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1580
        and:[UserPreferences current startTextDragWithControl not
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1581
             or:[sensor ctrlDown]]]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1582
            dragIsActive := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1583
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1584
            self unselect.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1585
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1586
        clickCount := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1587
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1588
        super buttonPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1589
    ]
813
7168eda47e3b Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 770
diff changeset
  1590
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1591
    "Modified: / 20.5.1999 / 17:02:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1592
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1593
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1594
buttonRelease:button x:x y:y
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1595
    "mouse- button release - turn off autoScroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1596
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1597
    (button == 1) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1598
        self hasSelection ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1599
            self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1600
            self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1601
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1602
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1603
        autoScrollBlock notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1604
            self stopScrollSelect
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1605
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1606
        dragIsActive ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1607
            self unselect
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1608
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1609
        clickPos := nil.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1610
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1611
        super buttonRelease:button x:x y:y
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1612
    ].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1613
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1614
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1615
    "/ clickPos := clickLine := clickCol := nil.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1616
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1617
    "Modified: / 20.5.1999 / 17:14:23 / cg"
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1618
!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1619
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1620
doubleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1621
    "double-click - select word under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1622
3588
a70267e5b501 st80 behavior: also scan for matching single quote
Claus Gittinger <cg@exept.de>
parents: 3587
diff changeset
  1623
    |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
  1624
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1625
    self selectWordAtX:x y:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1626
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1627
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1628
     special - if clicked on a parenthesis, select to matching
4702
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1629
     (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
  1630
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1631
    ((sel := self selection) size == 1
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  1632
     and:[(sel := sel at:1) size == 1]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1633
        ch := sel at:1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1634
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1635
        ((self isOpeningParenthesis:ch)
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  1636
         or:[self isClosingParenthesis:ch]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1637
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1638
                searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1639
                ifFound:[:line :col |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1640
                              |prevLine prevCol moveBack pos1|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1641
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1642
                              prevLine := firstLineShown.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1643
                              prevCol := viewOrigin x.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1644
                              self selectFromLine:selectionStartLine col:selectionStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1645
                                           toLine:line col:col.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1646
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1647
                              self sensor ctrlDown ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1648
                                  "/ undo scroll operation ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1649
                                  self withCursor:Cursor eye do:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1650
                                      |delayCount|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1651
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1652
                                      moveBack := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1653
                                      (self isClosingParenthesis:ch) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1654
                                           (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1655
                                               moveBack := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1656
                                           ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1657
                                      ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1658
                                           selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1659
                                               self makeLineVisible:selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1660
                                               moveBack := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1661
                                           ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1662
                                      ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1663
                                      moveBack ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1664
                                           delayCount  := 0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1665
                                           pos1 := x@y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1666
                                           self invalidateRepairNow:true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1667
                                           Delay waitForSeconds:MatchDelayTime.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1668
                                           delayCount := delayCount + MatchDelayTime.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1669
                                           [self sensor hasUserEventFor:self] whileFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1670
                                                Delay waitForSeconds:MatchDelayTime / 2.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1671
                                                delayCount := delayCount + (MatchDelayTime / 2).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1672
                                                delayCount > 2 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1673
                                                    self cursor:Cursor eyeClosed.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1674
                                                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1675
                                                delayCount >= 2.3 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1676
                                                    self cursor:Cursor eye.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1677
                                                    delayCount := 0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1678
                                                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1679
                                           ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1680
                                           self scrollToLine:prevLine; scrollToCol:prevCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1681
                                      ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1682
                                  ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1683
                              ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1684
                              ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1685
                          ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1686
                ifNotFound:[self showNotFound]
6264
3b7b675cbdf8 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6261
diff changeset
  1687
                onError:[self beepInEditor]
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1688
                openingCharacters:((parenthesisSpecification at:#open) ", '([{'")
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1689
                closingCharacters:((parenthesisSpecification at:#close) ", ')]}'").
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1690
            selectStyle := nil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1691
        ]
4702
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1692
    ].
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1693
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1694
    (self st80SelectMode or:[ self sensor ctrlDown]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1695
        "/ st80 selects:
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1696
        "/   - if clicked right after a parenthesis -> select to matching parenthesis
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1697
        "/   - if clicked right after a quote -> select to matching quote (unless escaped ;-)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1698
        "/   - if clicked at beginning of the line  -> select that line
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1699
        "/   - if clicked at the top of the text    -> select all
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1700
        "/ however, do none of the above, if clicked on a parenthesis
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1701
        clickCol == 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1702
            clickLine == 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1703
                self selectAll.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1704
                ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1705
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1706
            self selectLineAtY:y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1707
            selectStyle := #line.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1708
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1709
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1710
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1711
        matchCol := nil.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1712
        "/ see what is to the left of that character ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1713
        clickCol > 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1714
            ch := self characterAtLine:clickLine col:clickCol-1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1715
            (self isOpeningParenthesis:ch) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1716
                matchCol := clickCol - 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1717
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1718
                ('"''|' includes:ch) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1719
                    scanCol := clickCol - 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1720
                    fwdScan := true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1721
                    scanCh := ch.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1722
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1723
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1724
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1725
        fwdSelect := true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1726
        (matchCol isNil and:[scanCol isNil]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1727
            clickCol < (self listAt:clickLine) size ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1728
                ch := self characterAtLine:clickLine col:clickCol+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1729
                (self isClosingParenthesis:ch) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1730
                    matchCol := clickCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1731
                    fwdSelect := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1732
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1733
                    ('"''|' includes:ch) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1734
                        scanCol := clickCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1735
                        fwdScan := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1736
                        scanCh := ch.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1737
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1738
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1739
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1740
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1741
        matchCol notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1742
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1743
                searchForMatchingParenthesisFromLine:clickLine col:matchCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1744
                ifFound:[:line :col |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1745
                          self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1746
                                       toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1747
                ifNotFound:[self showNotFound]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1748
                onError:[self beep]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1749
                openingCharacters:((parenthesisSpecification at:#open) , '([{')
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1750
                closingCharacters:((parenthesisSpecification at:#close) , ')]}').
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1751
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1752
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1753
        scanCol notNil ifTrue:[
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  1754
            "/ if it's an EOL comment, do it differently
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1755
            ch := self characterAtLine:clickLine col:clickCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1756
            ch == $/ ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1757
                self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1758
                ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1759
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1760
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1761
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1762
                scanFor:scanCh fromLine:clickLine col:scanCol forward:fwdScan
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1763
                ifFound:[:line :col |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1764
                            |selStart selEnd|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1765
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1766
                            fwdScan ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1767
                                selStart := scanCol+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1768
                                selEnd := col-1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1769
                            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1770
                                selStart := scanCol-1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1771
                                selEnd := col+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1772
                            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1773
                            self selectFromLine:clickLine col:selStart
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1774
                                 toLine:line col:selEnd.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1775
                            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1776
                           ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1777
                ifNotFound:[self showNotFound].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1778
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1779
        ]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1780
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1781
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1782
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1783
     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
  1784
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1785
    wordStartLine := selectionStartLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1786
    wordEndLine := selectionEndLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1787
    selectStyle == #wordLeft ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1788
        wordStartCol := selectionStartCol + 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1789
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1790
        wordStartCol := selectionStartCol.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1791
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1792
    selectStyle == #wordRight ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1793
        wordEndCol := selectionEndCol - 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1794
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1795
        wordEndCol := selectionEndCol
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1796
    ]
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1797
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  1798
    "Created: / 11-09-1997 / 04:12:55 / cg"
4255
9bf0cc2595a9 changed: #doubleClickX:y:
Claus Gittinger <cg@exept.de>
parents: 4254
diff changeset
  1799
    "Modified: / 14-06-2011 / 14:04:59 / cg"
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  1800
    "Modified (format): / 13-02-2017 / 20:32:08 / cg"
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  1801
    "Modified (format): / 18-10-2018 / 17:06:07 / Stefan Vogel"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1802
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1803
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1804
extendSelectionToX:x y:y
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1805
    "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
  1806
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1807
    self extendSelectionToX:x y:y setPrimarySelection:true
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1808
!
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1809
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1810
extendSelectionToX:x y:y setPrimarySelection:aBoolean
6351
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1811
    "mouse-move while button was pressed or shift-clicked  
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1812
     - handle selection changes"
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1813
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1814
    |movedVisibleLine movedLine movedCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1815
     movedUp
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1816
     oldStartLine oldEndLine oldStartCol oldEndCol|
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
    movedVisibleLine := self visibleLineOfY:y.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1819
    movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1820
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1821
    (x < leftMargin) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1822
        movedCol := 0
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1823
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1824
        movedCol := self colOfX:x inVisibleLine:movedVisibleLine
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1825
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1826
    y < 0 ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1827
        movedCol := 0
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1828
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1829
    ((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1830
        selectionStartLine notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1831
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1832
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1833
        (clickPos isNil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1834
        or:[(clickPos x - x) abs < 3
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1835
            and:[(clickPos y - y) abs < 3]]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1836
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1837
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1838
        selectionStartLine := clickLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1839
        selectionStartCol := clickCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1840
        selectionEndLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1841
        selectionEndCol := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1842
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1843
        oldStartLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1844
        oldEndLine := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1845
        oldStartCol := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1846
        oldEndCol := selectionEndCol-1.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1847
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1848
        selectionStartLine isNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1849
            selectionStartLine := selectionEndLine := clickLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1850
            selectionStartCol := selectionEndCol := clickCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1851
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1852
        oldStartLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1853
        oldEndLine := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1854
        oldStartCol := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1855
        oldEndCol := selectionEndCol.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1856
    ].
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1857
    oldEndLine isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1858
        oldEndLine := selectionEndLine ? clickLine ? movedLine.
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1859
    ].
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1860
    oldEndCol isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1861
        oldEndCol := selectionEndCol ? clickCol.
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1862
    ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1863
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1864
    "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
  1865
    movedUp := false.
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1866
    clickStartLine isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1867
        clickStartLine := movedLine.
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1868
    ].
3505
cdb364dede3e extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
  1869
    clickStartCol isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1870
        clickStartCol := movedCol.
3505
cdb364dede3e extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
  1871
    ].
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1872
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1873
    (movedLine < clickStartLine) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1874
        movedUp := true
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1875
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1876
        (movedLine == clickStartLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1877
            (movedCol < clickStartCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1878
                movedUp := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1879
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1880
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1881
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1882
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1883
    movedUp ifTrue:[
6351
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1884
        "select backwards"
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1885
        selectionStartCol := movedCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1886
        selectionStartLine := movedLine.
6351
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1887
        "/ with shift-click, take char before cursor pos
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1888
        "/ with button motion, take char at cursor pos
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1889
        self sensor shiftDown ifTrue:[
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1890
            selectionEndCol := clickStartCol-1.
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1891
        ] ifFalse:[
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1892
            selectionEndCol := clickStartCol.
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1893
        ].    
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1894
        selectionEndLine := clickStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1895
        selectStyle notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1896
            selectionEndCol := wordEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1897
            selectionEndLine := wordEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1898
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1899
    ] ifFalse:[
6351
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1900
        "self forward"
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1901
        selectionEndCol := movedCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1902
        selectionEndLine := movedLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1903
        selectionStartCol := clickStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1904
        selectionStartLine := clickStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1905
        selectStyle notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1906
            selectionStartCol := wordStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1907
            selectionStartLine := wordStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1908
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1909
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1910
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1911
    selectionStartLine isNil ifTrue:[^ self].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1912
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1913
    (selectionStartCol == 0) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1914
        selectionStartCol := 1
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1915
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1916
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1917
    "
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1918
     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
  1919
    "
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1920
    (selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1921
        movedUp ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1922
            selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1923
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1924
            selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1925
            selectionEndCol == 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1926
                selectionEndLine := selectionEndLine + 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1927
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1928
        ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1929
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1930
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1931
    selectStyle == #line ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1932
        movedUp ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1933
            selectionStartCol := 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1934
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1935
            selectionEndCol := 0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1936
            selectionEndLine := selectionEndLine + 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1937
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1938
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1939
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1940
    self validateNewSelection.
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1941
    aBoolean ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1942
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1943
        self selectionChanged.
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1944
    ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1945
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  1946
    "/ 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
  1947
"/    self clearSearchAction.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1948
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1949
    (oldStartLine == selectionStartLine) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1950
        (oldStartCol ~~ selectionStartCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1951
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1952
                redrawLine:oldStartLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1953
                      from:((selectionStartCol min:oldStartCol) max:1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1954
                        to:((selectionStartCol max:oldStartCol) max:1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1955
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1956
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1957
        self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1958
            redrawFromLine:(oldStartLine?selectionStartLine min:selectionStartLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1959
                        to:(oldStartLine?selectionStartLine max:selectionStartLine)
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1960
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1961
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1962
    (oldEndLine == selectionEndLine) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1963
        (oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1964
            self redrawLine:oldEndLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1965
                       from:((selectionEndCol min:oldEndCol) max:1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1966
                         to:((selectionEndCol max:oldEndCol) max:1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1967
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1968
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1969
        selectionEndLine isNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1970
            selectionStartLine := nil.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1971
            self redraw.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1972
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1973
            (selectionStartLine notNil) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1974
                self redrawFromLine:(oldEndLine min:selectionEndLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1975
                                 to:(oldEndLine max:selectionEndLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1976
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1977
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1978
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1979
    clickLine := movedLine.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1980
    clickCol := movedCol
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1981
4234
65f202270d2c changed: #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 4178
diff changeset
  1982
    "Modified: / 05-04-2011 / 17:13:35 / cg"
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  1983
    "Modified: / 17-04-2012 / 21:00:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6351
31f344d402c3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6343
diff changeset
  1984
    "Modified: / 15-06-2018 / 13:55:19 / Claus Gittinger"
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1985
!
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1986
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1987
keyPress:key x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1988
    "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
  1989
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1990
    <resource: #keyboard (#Find #Copy #FindNext #FindPrev #FindAgain
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1991
                          #GotoLine #SelectAll #SaveAs #Print
6204
44cc5203397e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6202
diff changeset
  1992
                          #OpenWorkspaceOnIt
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1993
                          #'F*' #'f*')>
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1994
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1995
    (key == #Find) ifTrue:[self search. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1996
    (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
  1997
    (key == #GotoLine) ifTrue:[self gotoLine. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1998
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1999
    (key == #FindNext) ifTrue:[self searchFwd. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2000
    (key == #FindPrev) ifTrue:[self searchBwd. ^self].
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2001
    (key == #FindAgain) ifTrue:[self searchAgainInSameDirection. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2002
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2003
    (key == #SelectAll) ifTrue:[self selectAll. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2004
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2005
    (key == #SaveAs)    ifTrue:[self save.    ^self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2006
    (key == #Print)     ifTrue:[self doPrint. ^self].
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  2007
6204
44cc5203397e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6202
diff changeset
  2008
    (key == #OpenWorkspaceOnIt) ifTrue:[self openWorkspaceWithIt. ^self].
44cc5203397e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6202
diff changeset
  2009
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2010
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2011
     shift-Fn defines a key-sequence
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2012
     Fn       pastes that sequence
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2013
     cmd-Fn   performs a 'doIt' on the sequence (Workspaces only)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2014
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2015
     (see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2016
    "
6292
209780dfc5a7 #BUGFIX by mawalch
mawalch
parents: 6286
diff changeset
  2017
    "/ do NOT replace by notEmptyOrNil !!!!!!
209780dfc5a7 #BUGFIX by mawalch
mawalch
parents: 6286
diff changeset
  2018
    "/ key can be a character!!!!!!!!
209780dfc5a7 #BUGFIX by mawalch
mawalch
parents: 6286
diff changeset
  2019
    (key size > 0 and:[(key at:1) asLowercase == $f]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2020
        (('[fF][0-9]' match:key)
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2021
         or:['[fF][0-9][0-9]' match:key]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2022
            self sensor shiftDown ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2023
                UserPreferences current functionKeySequences
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2024
                    at:key put:(self selection)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2025
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2026
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2027
        ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2028
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2029
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2030
    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
  2031
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2032
    "Modified (format): / 30-03-2017 / 22:35:58 / stefan"
6204
44cc5203397e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6202
diff changeset
  2033
    "Modified: / 01-09-2017 / 14:32:27 / cg"
6292
209780dfc5a7 #BUGFIX by mawalch
mawalch
parents: 6286
diff changeset
  2034
    "Modified: / 09-03-2018 / 00:58:56 / mawalch"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2035
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2036
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2037
mapped
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2038
    super mapped.
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  2039
    selectionFgColor := selectionFgColor onDevice:device.
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  2040
    selectionBgColor := selectionBgColor onDevice:device.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2041
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2042
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2043
quadClickX:x y:y
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2044
    "quadrupleClick-click - select all"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2045
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2046
    self selectAll
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2047
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2048
    "Created: / 11.9.1997 / 04:15:24 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2049
    "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
  2050
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2051
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2052
tripleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2053
    "triple-click - select line under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2054
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2055
    self selectLineAtY:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2056
    selectStyle := #line
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2057
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2058
    "Created: 11.9.1997 / 04:13:37 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2059
! !
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2060
2120
1054ce5c8fe7 category change
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
  2061
!TextView methodsFor:'initialization & release'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2062
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  2063
fetchDeviceResources
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  2064
    "fetch device colors, to avoid reallocation at redraw time"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  2065
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  2066
    super fetchDeviceResources.
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  2067
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  2068
    selectionFgColor notNil ifTrue:[selectionFgColor := selectionFgColor onDevice:device].
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  2069
    selectionBgColor notNil ifTrue:[selectionBgColor := selectionBgColor onDevice:device].
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  2070
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  2071
    "Created: 14.1.1997 / 00:14:33 / cg"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  2072
!
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  2073
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2074
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  2075
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  2076
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2077
    super initStyle.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2078
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2079
    viewBackground := DefaultViewBackground.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2080
    selectionFgColor := DefaultSelectionForegroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2081
    selectionFgColor isNil ifTrue:[selectionFgColor := bgColor].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2082
    selectionBgColor := DefaultSelectionBackgroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2083
    selectionBgColor isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2084
        device hasColors ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2085
            DefaultSelectionForegroundColor isNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2086
                selectionFgColor := fgColor
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2087
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2088
            selectionBgColor := Color green
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2089
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2090
            device hasGrayscales ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2091
                DefaultSelectionForegroundColor isNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2092
                    selectionFgColor := fgColor
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2093
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2094
                selectionBgColor := Color gray
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2095
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2096
                selectionBgColor := fgColor
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2097
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2098
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2099
    ].
708
e8eb52699f90 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  2100
4321
4c8c94f6e1c6 comemnt in: #initStyle
az
parents: 4310
diff changeset
  2101
    "Modified: / 22-01-1997 / 11:57:53 / cg"
4c8c94f6e1c6 comemnt in: #initStyle
az
parents: 4310
diff changeset
  2102
    "Modified (comment): / 05-10-2011 / 15:50:45 / az"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2103
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2104
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2105
initialize
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2106
    super initialize.
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2107
    self initializeSaveAction.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2108
    contentsWasSaved := false.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  2109
    dragIsActive     := false.
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2110
    lastSearchWasMatch := lastSearchWasVariableSearch := false.
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2111
    lastSearchIgnoredCase := true.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2112
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2113
    parenthesisSpecification isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2114
        parenthesisSpecification := DefaultParenthesisSpecification.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2115
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2116
911
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  2117
    "I handle menus myself"
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  2118
    menuHolder := menuPerformer := self.
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  2119
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  2120
    "/ on default allow drag
96256221e3af support drag
ca
parents: 2581
diff changeset
  2121
    self allowDrag:true.
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2122
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2123
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2124
initializeSaveAction
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2125
    saveAction := [ self openSaveDialog ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2126
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2127
4450
ef24b9b60ec1 category of:21 methods
Claus Gittinger <cg@exept.de>
parents: 4437
diff changeset
  2128
!TextView methodsFor:'menu & menu actions'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2129
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2130
appendTo:aFileName
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2131
    "append contents to a file named fileName"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2132
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2133
    |aStream msg filename|
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2134
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2135
    filename := aFileName asFilename.
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2136
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2137
    (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2138
        msg := resources string:'Refused to append to file ''%1'' !!' with:filename name.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2139
        self warn:(msg , '\\(ST/X internal permission check)' ) withCRs.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2140
        ^ self
2036
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  2141
    ].
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  2142
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2143
    [
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2144
        aStream := filename appendingWriteStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2145
        [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2146
            self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2147
        ] ensure:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2148
            aStream close.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2149
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2150
        contentsWasSaved := true
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2151
    ] on:FileStream openErrorSignal do:[:ex|
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2152
        msg := resources string:'cannot append to file %1 !!' with:filename name.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2153
        self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2154
    ]
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2155
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2156
    "Modified: / 27-07-2012 / 09:41:18 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2157
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2158
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2159
changeFont
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2160
    "pop up a fontPanel to change font"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2161
5676
20a8f1c87323 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5675
diff changeset
  2162
    |newFont fp userPrefs fontPrefs newFontPrefs|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2163
5005
2acadbbf1bce class: TextView
Claus Gittinger <cg@exept.de>
parents: 5004
diff changeset
  2164
    self withWaitCursorDo:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2165
        fp := FontPanel new.
5902
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2166
        newFont := 
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2167
            fp  fontFromUserInitial:gc font 
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2168
                    title:nil
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2169
                    filter:nil
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2170
                    encoding:nil
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2171
                    enabled:true
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2172
                    withChangeAllOption:true.
5005
2acadbbf1bce class: TextView
Claus Gittinger <cg@exept.de>
parents: 5004
diff changeset
  2173
    ].
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2174
    newFont notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2175
        self font:newFont.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2176
        fp changeFontInAllViews ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2177
            "/ user checked this box - change the defaults,
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2178
            "/ and update all other textviews now.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2179
            userPrefs := UserPreferences current.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2180
            fontPrefs := userPrefs fontPreferences.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2181
            fontPrefs isNil ifTrue:[ fontPrefs := newFontPrefs := Dictionary new ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2182
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2183
            fontPrefs at:#Text put:(newFont storeString).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2184
            newFontPrefs notNil ifTrue:[ userPrefs fontPreferences:newFontPrefs ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2185
            userPrefs beModified.
5914
1db68d37c59c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  2186
            "/ DebugView newDebugger.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2187
            TextView allSubInstances do:[:v |
5912
68a1083420e5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  2188
                v class defaultFont:newFont.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2189
                v font:newFont
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2190
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2191
        ].
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2192
    ]
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2193
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2194
    "Modified: 27.2.1996 / 00:53:51 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2195
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2196
6202
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2197
compareAgainst:otherText named:whatIsIt
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2198
    "common code for compate with file and compare with clipboard"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2199
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2200
    |myText|
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2201
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2202
    otherText isEmptyOrNil ifTrue:[
6205
4f25a348e0e2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6204
diff changeset
  2203
        Dialog information:(resources string:(whatIsIt,' is empty.')). "/ don't use %1 - may need different xlations
6202
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2204
        ^ self.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2205
    ].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2206
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2207
    self hasSelection ifTrue:[
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2208
        myText := self selectionAsString.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2209
    ] ifFalse:[
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2210
        myText := self contents asString
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2211
    ].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2212
    myText := myText string.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2213
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2214
    myText = otherText ifTrue:[
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2215
        Dialog information:(resources string:'Strings are equal.').
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2216
        ^ self.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2217
    ].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2218
    DiffTextView
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2219
        openOn:myText label:'Editor'
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2220
        and:otherText label:whatIsIt
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2221
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2222
    "Created: / 01-09-2017 / 14:11:20 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2223
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2224
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2225
compareWithClipboard
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2226
    "compare the selection against the clipboard contents"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2227
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2228
    self compareAgainst:(self getClipboardText) named:'Clipboard'
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2229
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2230
    "Modified: / 01-09-2017 / 14:11:44 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2231
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2232
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2233
compareWithFile
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2234
    "compare the selection or the whole text against the contents of a file"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2235
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2236
    |fn fileText|
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2237
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2238
    fn := Dialog requestFileName:(resources string:'Compare against file:') 
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2239
                 default:defaultFileNameForFileDialog.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2240
    fn isEmptyOrNil ifTrue:[^ self].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2241
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2242
    fileText := fn asFilename contentsOfEntireFile.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2243
    self compareAgainst:fileText named:'File'
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2244
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2245
    "Modified: / 01-09-2017 / 14:11:15 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2246
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2247
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2248
copySelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2249
    "copy contents into smalltalk copybuffer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2250
863
ed4282df00a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
  2251
    |text|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2252
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2253
    text := self selection.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2254
    text notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2255
        self unselect.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2256
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2257
        "/ forget any emphasis ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2258
        text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2259
        self setClipboardText:text.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2260
    ]
649
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  2261
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  2262
    "Modified: 17.5.1996 / 08:57:54 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2263
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2264
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2265
copySelectionBox
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2266
    "copy contents into the smalltalk copybuffer.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2267
     This copies it as a rectangular text area (INed/MAXed-like)"
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2268
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2269
    |text startCol endCol len|
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2270
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2271
    text := self selection.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2272
    text notNil ifTrue:[
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2273
        "/ forget any emphasis ...
6206
f7a386aee648 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6205
diff changeset
  2274
        text := text collect:[:line | line isNil ifTrue:[''] ifFalse:[line string]].
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2275
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2276
        startCol := selectionStartCol.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2277
        endCol := selectionEndCol.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2278
        len := endCol - startCol + 1.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2279
        text := text keysAndValuesCollect:[:idx :line |
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2280
                    
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2281
                    idx == 1 ifTrue:[
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2282
                        (line paddedTo:len) copyTo:len    
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2283
                    ] ifFalse:[
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2284
                        (line paddedTo:startCol+len-1) copyFrom:startCol
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2285
                    ].
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2286
                ].    
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2287
        self unselect.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2288
        self setClipboardText:text.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2289
    ]
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2290
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2291
    "Created: / 14-03-2017 / 16:06:02 / cg"
6206
f7a386aee648 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6205
diff changeset
  2292
    "Modified (format): / 01-09-2017 / 14:43:07 / cg"
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2293
!
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2294
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2295
defaultForGotoLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2296
    "return a default value to show in the gotoLine box"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2297
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  2298
    ^ self selectionStartLine
447
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2299
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2300
    "Modified: 1.3.1996 / 18:44:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2301
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2302
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2303
doPrint
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2304
    "print the contents on the printer"
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2305
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2306
    |printStream|
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2307
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2308
    list isNil ifTrue:[^ self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2309
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2310
    self withWaitCursorDo:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2311
        printStream := Printer new.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2312
        printStream supportsContext ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2313
            printStream printerContext font:(self font).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2314
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2315
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2316
        Printer writeErrorSignal handle:[:ex |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2317
            self warn:('error while printing:\\'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2318
                        , ex description
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2319
                        , '\\(printing with: ' , (Printer printCommand) , ')') withCRs
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2320
        ] do:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2321
            self fileOutContentsOn:printStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2322
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2323
        printStream close
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2324
    ].
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2325
4363
4ed2feefc2c2 changed: #doPrint
Claus Gittinger <cg@exept.de>
parents: 4361
diff changeset
  2326
    "Created: / 06-05-1996 / 16:11:26 / cg"
4ed2feefc2c2 changed: #doPrint
Claus Gittinger <cg@exept.de>
parents: 4361
diff changeset
  2327
    "Modified: / 31-01-2012 / 18:16:39 / cg"
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2328
!
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2329
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2330
editMenu
1109
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  2331
    "return my popUpMenu"
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  2332
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  2333
    <resource: #keyboard (#Copy #Find #GotoLine #SaveAs #Print)>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  2334
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  2335
6375
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2336
    |item1 items m toolItems toolSubMenu|
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2337
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2338
    self sensor metaDown ifTrue:[
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2339
        item1 := #(
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2340
                        ('Copy Box'      copySelectionBox  CopyBox)
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2341
                 )        
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2342
    ] ifFalse:[
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2343
        item1 := #(
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2344
                        ('Copy'          copySelection  Copy)
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2345
                 )        
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2346
    ].    
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2347
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2348
    items := item1 , #(
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2349
                        ('-'             nil            )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2350
                        ('Search...'     search         Find)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2351
                        ('Goto Line...'  gotoLine       GotoLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2352
                        ('-'             nil            )
6375
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2353
                        ('Tools'         tools          )
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2354
                        ('Font...'       changeFont     )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2355
                        ('-'             nil            )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2356
                        ('Save As...'    save           SaveAs)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2357
                        ('Print'         doPrint        Print)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2358
                ).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2359
6375
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2360
    toolItems := #(
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2361
                    ('Open FileBrowser on It'      openFileBrowserOnIt        )
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2362
                    ('Open WebBrowser on It'       openWebBrowserOnIt         )
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2363
              ).
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2364
1545
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2365
    m := PopUpMenu itemList:items resources:resources.
6375
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2366
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2367
    toolSubMenu := PopUpMenu itemList:toolItems resources:resources performer:model.
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2368
    toolSubMenu receiver:self.
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2369
    m subMenuAt:#tools put:toolSubMenu.
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2370
    
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2371
    self hasSelectionForCopy ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2372
        m disable:#copySelection.
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2373
        m disable:#copySelectionBox.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2374
    ].
6375
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2375
    self hasSelection ifFalse:[
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2376
        m disableAll:#(openFileBrowserOnIt openWebBrowserOnIt).
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2377
    ] ifTrue:[
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2378
        (Error handle:[:ex |
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2379
            ex return:false
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2380
        ] do:[
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2381
            |fn|
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2382
            fn := self selectionAsString withoutSeparators.
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2383
            fn asFilename exists or:[ fn withoutQuotes asFilename exists ]
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2384
        ]) ifFalse:[
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2385
            m disableAll:#(openFileBrowserOnIt).
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2386
        ].
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2387
        (Error handle:[:ex |
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2388
            ex return:false
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2389
        ] do:[
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2390
            |url|
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2391
            url := self selectionAsString withoutSeparators.
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2392
            #('http' 'https' 'ftp') includes:url asURL method
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2393
        ]) ifFalse:[
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2394
            m disableAll:#(openWebBrowserOnIt).
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2395
        ]
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2396
    ].    
6146
3cf6c9894f53 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6140
diff changeset
  2397
    m := m asMenu.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2398
    ^ m
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  2399
6146
3cf6c9894f53 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6140
diff changeset
  2400
    "Modified: / 12-04-2017 / 09:06:22 / cg"
6375
0ee929d79a08 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
  2401
    "Modified: / 06-07-2018 / 08:42:17 / Claus Gittinger"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2402
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2403
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2404
find
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2405
    "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
  2406
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2407
    self search
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2408
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2409
    "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
  2410
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2411
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2412
gotoLine
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2413
    "show a box to enter lineNumber for positioning;
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2414
     The entered number may be prefixed by a + or -;
1926
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  2415
     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
  2416
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2417
    |l lineNumberBox input lineToGo relative peekc|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2418
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2419
    lineNumberBox :=
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2420
        EnterBox
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2421
           title:(resources string:'Line number (or +/- relativeNr):')
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2422
           okText:(resources string:'Goto')
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2423
           abortText:(resources string:'Cancel')
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2424
           action:[:l | input := l readStream].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2425
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2426
    l := self defaultForGotoLine.
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2427
    lineNumberBox initialText:(l ifNotNil:[l printString]).
3394
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
  2428
    lineNumberBox label:(resources string:'Goto Line').
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2429
    lineNumberBox showAtPointer.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2430
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2431
    input isNil ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2432
        ^ self.
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2433
    ].
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2434
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2435
    peekc := input skipSpaces.
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2436
    peekc notNil ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2437
        (peekc == $+) ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2438
            relative := 1.
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2439
        ] ifFalse:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2440
            (peekc == $-) ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2441
                relative := -1.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2442
            ].
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2443
        ].
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2444
        relative notNil ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2445
            input next.
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2446
        ].
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2447
        lineToGo := Integer readFrom:input onError:[^ self].
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2448
        relative notNil ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2449
            lineToGo := self currentLine + (lineToGo * relative)
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2450
        ].
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2451
        self gotoLine:lineToGo.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2452
    ].
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2453
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2454
    "Modified: / 17-05-1998 / 20:07:59 / cg"
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2455
    "Modified: / 30-03-2017 / 23:05:07 / stefan"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2456
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2457
6202
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2458
openFileBrowserOnFileNamed:fileNameString
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2459
    "open a fileBrowser on the given fileNameString"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2460
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2461
    |fn|
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2462
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2463
    fn := fileNameString asFilename.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2464
    fn exists ifFalse:[
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2465
        fn := fileNameString withoutSeparators withoutQuotes asFilename.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2466
        fn exists ifFalse:[
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2467
            ^ self warn:(resources
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2468
                            string:'Sorry - file "%1" was not found in directory "%2"'
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2469
                            with:fn baseName allBold
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2470
                            with:fn directory baseName allBold).
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2471
        ].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2472
    ].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2473
    FileBrowser default openOn:fn
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2474
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2475
    "Modified: / 01-09-2017 / 14:03:54 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2476
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2477
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2478
openFileBrowserOnIt
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2479
    "open a fileBrowser on the selected fileName"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2480
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2481
    |fileNameString|
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2482
6373
065fd51ae5b2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6358
diff changeset
  2483
    fileNameString := self selectionAsString withoutSeparators.
6202
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2484
    self openFileBrowserOnFileNamed:fileNameString
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2485
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2486
    "Modified: / 06-09-2012 / 14:47:22 / cg"
6373
065fd51ae5b2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6358
diff changeset
  2487
    "Modified: / 06-07-2018 / 07:30:20 / Claus Gittinger"
6202
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2488
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2489
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2490
openSaveDialog
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2491
    "Ask user for filename using a fileSelectionBox
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2492
     and save contents into that file."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2493
2695
7e13db2802df better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
  2494
    Dialog
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2495
        requestSaveFileName:(resources string:'Save contents in:')
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2496
        default:defaultFileNameForFileDialog
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2497
        fromDirectory:directoryForFileDialog
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2498
        action:[:fileName | self saveAs:fileName]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2499
        appendAction:[:fileName | self appendTo:fileName]
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2500
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2501
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2502
openSearchBoxAndSearch
5736
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2503
    "search for a string - show a box to enter searchpattern.
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2504
     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
  2505
     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
  2506
     would no be appropriate..."
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2507
6324
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2508
    ^ self openSearchBoxAndSearchWithReplaceChecked:false
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2509
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2510
    "Modified: / 11-07-2006 / 11:18:38 / fm"
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2511
    "Created: / 08-03-2012 / 14:02:59 / cg"
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2512
    "Modified: / 22-05-2018 / 15:48:41 / Claus Gittinger"
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2513
!
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2514
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2515
openSearchBoxAndSearchWithReplaceChecked:replaceChecked
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2516
    "search for a string - show a box to enter searchpattern and replace options.
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2517
     If replaceChecked is true, the 'replace' checkbox and 'replace to end' are
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2518
     initially checked, and the focus is on the replace field.
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2519
     TODO: this started as an ad-hoc box, which is manually constructed.
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2520
     over time, it got more and more functions, so a separate appModel class
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2521
     would now be appropriate..."
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2522
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2523
    "
4985
414cb5cbe48f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4885
diff changeset
  2524
     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
  2525
     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
  2526
    "
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2527
    |searchBox patternHolder caseHolder matchHolder matchWithRegexHolder wrapAtEndHolder
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2528
     fwd last ign match initialString
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2529
     bindings bldr doSearch modal searchVariableHolder selectedVariable searchFullWordHolder selectLinesHolder
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2530
     replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2531
     replaceAllBooleanHolder replacePreserveCaseBooleanHolder
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
  2532
     searchAtBeginOfLineOnlyHolder searchAtEndOfLineOnlyHolder updateReturnKeyBehavior|
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2533
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2534
    searchBarActionBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2535
        self resetVariablesBeforeNewSearch.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2536
        searchBarActionBlock value:#search value:self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2537
        ^ self
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2538
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2539
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2540
    modal := (UserPreferences current searchDialogIsModal).   "/ that's experimental
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2541
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2542
    (searchBox := self objectAttributeAt:#currentModelessSearchBox) notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2543
        (modal not
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2544
        and:[ searchBox window realized ]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2545
            "/ reuse it.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2546
            searchBox window
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2547
                raiseDeiconified;
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2548
                requestFocus;
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2549
                assignKeyboardFocusToFirstKeyboardConsumer.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2550
            ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2551
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2552
        searchBox closeRequest.
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2553
    ].
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2554
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2555
    ign := lastSearchIgnoredCase "? LastSearchIgnoredCase " ? true.
6324
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2556
    replaceChecked ifTrue:[ign := false].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2557
    caseHolder := ign not asValue.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2558
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2559
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2560
    matchHolder := match asValue.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2561
    matchWithRegexHolder := (LastSearchWasMatchWithRegex ? false) asValue.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2562
    wrapAtEndHolder := (LastSearchWasWrapAtEndOfText ? false) asValue.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2563
    searchVariableHolder := (lastSearchWasVariableSearch ? false) asValue.
6324
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2564
    searchFullWordHolder := replaceChecked asValue.
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2565
    searchAtBeginOfLineOnlyHolder := false asValue.
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
  2566
    searchAtEndOfLineOnlyHolder := false asValue.
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2567
    selectLinesHolder := false asValue.
6324
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2568
    replaceBooleanHolder := replaceChecked asValue.
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2569
    replaceAllBooleanHolder := replaceChecked asValue.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2570
    replacePreserveCaseBooleanHolder := false asValue.
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2571
    replaceTextHolder := (LastSearchReplacedString ? '') asValue.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2572
    replaceBooleanEnabledHolder := self isReadOnly not asValue.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2573
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2574
    patternHolder := '' asValue.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2575
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2576
    self setSearchPatternWithMatchEscapes: match.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2577
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2578
    lastSearchPattern notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2579
        initialString := lastSearchPattern.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2580
    ].
6324
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2581
    "/  No longer force the current selection to be the initialString
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2582
    "/    self hasSelectionWithinSingleLine ifTrue:[
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2583
    "/        initialString := self selection asString.
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2584
    "/    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2585
    initialString isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2586
        LastSearchPatterns size > 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2587
            initialString := LastSearchPatterns first.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2588
        ]
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2589
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2590
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2591
    initialString notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2592
        patternHolder value:initialString.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2593
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2594
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2595
    fwd := true.
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2596
    last := false.
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2597
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2598
    doSearch := [:fwdOrLast |
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2599
        |isVariableSearch pattern searchAction fwd last|
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2600
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2601
        fwdOrLast == #last ifTrue:[
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2602
            fwd := last := true.
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2603
        ] ifFalse:[
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2604
            fwd := fwdOrLast.
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2605
            last := false
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2606
        ].
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2607
        
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2608
        self resetVariablesBeforeNewSearch.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2609
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2610
        isVariableSearch := self searchVariableVisible
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2611
                                and:[searchVariableHolder value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2612
                                and:[selectedVariable notNil]].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2613
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2614
        isVariableSearch ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2615
            searchAction :=
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2616
                [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2617
                    self searchVariableWithSyntaxElement:selectedVariable forward:fwd
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2618
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2619
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2620
            lastSearchWasVariableSearch := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2621
            LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2622
            LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2623
            LastSearchWasMatchWithRegex := matchWithRegexHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2624
            LastSearchWasWrapAtEndOfText := wrapAtEndHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2625
            LastSearchWasReplace :=replaceBooleanHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2626
            LastSearchReplacedString := replaceTextHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2627
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2628
            pattern := patternHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2629
            pattern notEmptyOrNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2630
                searchAction :=
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2631
                    [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2632
                        self searchUsingSpec:(
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2633
                            self class searchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2634
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2635
                                ignoreCase:lastSearchIgnoredCase
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2636
                                match: lastSearchWasMatch
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2637
                                regexMatch:matchWithRegexHolder value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2638
                                variable: searchVariableHolder value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2639
                                fullWord: searchFullWordHolder value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2640
                                forward:fwd
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2641
                                atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
  2642
                                wrapAtEnd:wrapAtEndHolder value;
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
  2643
                                atEndOfLineOnly:searchAtEndOfLineOnlyHolder value).
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2644
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2645
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2646
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2647
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2648
        replaceBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2649
            |selStart replacement replaceAction|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2650
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2651
            replacement := replaceTextHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2652
            isVariableSearch ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2653
                "/ must replace from the end towards beginning,
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2654
                "/ because syntax-elements do not update their position, when
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2655
                "/ the text is changed (in replace).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2656
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2657
                selectedVariable := selectedVariable lastElementInChain.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2658
                self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2659
                searchAction :=
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2660
                    [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2661
                        selectedVariable := selectedVariable previousElement.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2662
                        selectedVariable notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2663
                            self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2664
                        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2665
                        "/ self searchVariableWithSyntaxElement:selectedVariable forward:false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2666
                    ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2667
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2668
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2669
            replaceAction := [ self replace:replacement ]. "/ not implemented here, but in subclasses
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2670
            replacePreserveCaseBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2671
                replaceAction := [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2672
                    self selectionAsString isUppercaseFirst ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2673
                        self replace:replacement asUppercaseFirst
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2674
                    ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2675
                        self replace:replacement asLowercaseFirst
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2676
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2677
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2678
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2679
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2680
            selStart := self characterPositionOfSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2681
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2682
            replaceAction value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2683
            searchAction value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2684
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2685
            replaceAllBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2686
                [self characterPositionOfSelection ~= selStart] whileTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2687
                    selStart := self characterPositionOfSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2688
                    replaceAction value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2689
                    searchAction value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2690
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2691
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2692
        ] ifFalse:[
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2693
            |selStart|
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2694
            
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2695
            selStart := self characterPositionOfSelection.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2696
            searchAction value.
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2697
            last ifTrue:[
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2698
                [
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2699
                    self characterPositionOfSelection ~= selStart] whileTrue:[
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2700
                        selStart := self characterPositionOfSelection.
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2701
                        searchAction value.
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2702
                    ].    
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2703
            ].    
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2704
        ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2705
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2706
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2707
    bindings := IdentityDictionary new.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2708
    bindings at:#searchPattern put:patternHolder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2709
    modal ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2710
        bindings
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2711
            at:#lastAction
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2712
            put:[
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2713
                replaceAllBooleanHolder value ifTrue:[
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2714
                    fwd := #last. searchBox doAccept.
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2715
                    searchBox doAccept.
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2716
                ] ifFalse:[
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2717
                    doSearch value:#last
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2718
                ]
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2719
            ].
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2720
        bindings
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2721
            at:#nextAction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2722
            put:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2723
                replaceAllBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2724
                    searchBox doAccept.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2725
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2726
                    doSearch value:true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2727
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2728
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2729
        bindings
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2730
            at:#prevAction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2731
            put:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2732
                replaceAllBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2733
                    fwd := false. searchBox doAccept.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2734
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2735
                    doSearch value:false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2736
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2737
            ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2738
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2739
        bindings at:#nextAction put:[doSearch value:true.].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2740
        bindings at:#prevAction put:[doSearch value:false.].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2741
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2742
    bindings at:#caseSensitive put:caseHolder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2743
    bindings at:#match put:matchHolder.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2744
    bindings at:#matchWithRegex put:matchWithRegexHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2745
    Regex::RxMatcher isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2746
        bindings at:#matchWithRegexVisible put:false.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2747
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2748
        bindings at:#matchWithRegexVisible put:matchHolder
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2749
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2750
    bindings at:#patternList put:LastSearchPatterns.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2751
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2752
    self supportsSyntaxElements ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2753
        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
  2754
    ] ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2755
        bindings at:#searchVariableVisible put:true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2756
        selectedVariable := self syntaxElementForSelectedVariable.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2757
        bindings at:#searchVariableEnabled put:(selectedVariable notNil).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2758
        selectedVariable notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2759
            bindings
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2760
                at:#stringWithVariableUnderCursorHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2761
                put:(resources string:'Variable ("%1")' with:selectedVariable name).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2762
            "/ searchVariableHolder value:true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2763
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2764
            bindings
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2765
                at:#stringWithVariableUnderCursorHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2766
                put:(resources string:'Variable (none selected)').
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2767
        ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2768
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2769
    bindings at:#searchVariable put:searchVariableHolder.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2770
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2771
    bindings at:#searchFullWord put:searchFullWordHolder.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2772
    bindings at:#searchFullWordEnabled put:true.
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2773
    bindings at:#searchAtBeginOfLineOnly put:searchAtBeginOfLineOnlyHolder.
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
  2774
    bindings at:#searchAtEndOfLineOnly put:searchAtEndOfLineOnlyHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2775
    bindings at:#wrapAtEndOfTextHolder put:wrapAtEndHolder.
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2776
    bindings at:#selectLinesHolder put:selectLinesHolder.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2777
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
  2778
    bindings at:#atEndOfLineOnlyEnabled put:(BlockValue forLogicalNot:matchHolder).
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
  2779
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2780
    bindings at:#replaceEnabled put:replaceBooleanEnabledHolder.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2781
    bindings at:#replaceBoolean put:replaceBooleanHolder.
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2782
    bindings at:#replaceAllBoolean put:replaceAllBooleanHolder.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2783
    bindings at:#replacePreserveCaseBoolean put:replacePreserveCaseBooleanHolder.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2784
    bindings at:#replaceTextHolder put:replaceTextHolder.
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2785
6256
76350fb3380f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
  2786
    bindings at:#helpSpec put:self class helpSpec.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2787
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2788
    updateReturnKeyBehavior :=
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2789
        [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2790
            |lbl returnAction|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2792
            "/ when replacing, do not close box on return
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2793
            replaceBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2794
                lbl := 'Close'.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2795
                returnAction := searchAction.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2796
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2797
                lbl := 'Cancel'.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2798
                returnAction := nil.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2799
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2800
            (bldr componentAt:#cancelButton) label:(resources string:lbl).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2801
            searchBox window keyboardProcessor returnAction:returnAction.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2802
        ].
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2803
5010
ad4a10879e16 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5005
diff changeset
  2804
    replaceBooleanHolder onChangeEvaluate:
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2805
        [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2806
            replaceBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2807
                (bldr componentAt:#ReplaceEntryField) requestFocus
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2808
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2809
                (bldr componentAt:#patternComboBox) requestFocus
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2810
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2811
            updateReturnKeyBehavior value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2812
        ].
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2813
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2814
    modal ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2815
        searchBox := SimpleDialog new.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2816
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2817
        searchBox := ApplicationModel new.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2818
        searchBox createBuilder.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2819
        bindings at:#cancel put:[ searchBox closeRequest ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2820
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2821
    searchBox resources:(self resources).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2822
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2823
    bldr := searchBox builder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2824
    bldr addBindings:bindings.
6256
76350fb3380f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
  2825
    bldr aspectAt:#helpSpec put:(self class helpSpec).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2826
    searchBox allButOpenFrom:(self class searchDialogSpec).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2827
6324
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2828
    replaceChecked ifTrue:[
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2829
        bldr window label:'String search & replace'.
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2830
        bldr keyboardProcessor componentWithInitialFocus:(bldr componentAt:#ReplaceEntryField).
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2831
    ].
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2832
    
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2833
    (bldr componentAt:#nextButton) cursor:(Cursor thumbsUp).
6378
3cf0a2838cb8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6375
diff changeset
  2834
    (bldr componentAt:#lastButton) cursor:(Cursor thumbsUp).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2835
    (bldr componentAt:#prevButton) cursor:(Cursor thumbsUp).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2836
    (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2837
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2838
    modal ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2839
        updateReturnKeyBehavior value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2840
        searchBox openDialogAtPointer.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2841
        searchBox accepted ifTrue:[ doSearch value:fwd ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2842
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2843
        (bldr componentAt:#nextButton) isReturnButton:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2844
        (bldr componentAt:#cancelButton)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2845
                label:(resources string:'Close');
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2846
                action:[searchBox closeRequest].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2847
        "/ searchBox masterApplication:self application.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2848
        self topView beMaster.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2849
        searchBox window
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2850
                beSlave;
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2851
                openInGroup:(self windowGroup);
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2852
                waitUntilVisible;
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2853
                assignKeyboardFocusToFirstKeyboardConsumer.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2854
        searchBox window keyboardProcessor
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2855
            addAccelerator:#Return action:(bindings at:#nextAction);
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2856
            addAccelerator:#Escape action:#closeRequest.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2857
        "/ remember this box for me.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2858
        self objectAttributeAt:#currentModelessSearchBox put:searchBox.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2859
    ]
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2860
6324
8e8b519078f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6312
diff changeset
  2861
    "Created: / 22-05-2018 / 15:47:29 / Claus Gittinger"
6428
ee9bb5de3bbc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6378
diff changeset
  2862
    "Modified: / 13-09-2018 / 10:23:59 / Claus Gittinger"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2863
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2864
6358
c260ba065216 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6351
diff changeset
  2865
openWebBrowserOnIt
c260ba065216 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6351
diff changeset
  2866
    "open a webBrowser on the selected url"
c260ba065216 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6351
diff changeset
  2867
c260ba065216 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6351
diff changeset
  2868
    |urlString|
c260ba065216 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6351
diff changeset
  2869
6373
065fd51ae5b2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6358
diff changeset
  2870
    urlString := self selectionAsString withoutSeparators.
065fd51ae5b2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6358
diff changeset
  2871
    OperatingSystem 
065fd51ae5b2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6358
diff changeset
  2872
        openApplicationForDocument:urlString 
065fd51ae5b2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6358
diff changeset
  2873
        operation:#open 
065fd51ae5b2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6358
diff changeset
  2874
        mimeType:'text/html'.
6358
c260ba065216 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6351
diff changeset
  2875
c260ba065216 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6351
diff changeset
  2876
    "Created: / 21-06-2018 / 17:15:27 / Claus Gittinger"
6373
065fd51ae5b2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6358
diff changeset
  2877
    "Modified (format): / 06-07-2018 / 07:29:19 / Claus Gittinger"
6358
c260ba065216 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6351
diff changeset
  2878
!
c260ba065216 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6351
diff changeset
  2879
6202
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2880
openWorkspaceWithIt
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2881
    "open a workspace containing the selected text"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2882
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2883
    |text|
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2884
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2885
    text := self selectionAsString.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2886
    WorkspaceApplication openWith:text selected:true
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2887
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2888
    "Created: / 26-05-2007 / 06:05:22 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2889
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2890
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2891
replace:someText
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2892
    "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
  2893
     Subclasses may redefine me."
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2894
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2895
    ^ self.
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2896
!
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2897
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2898
save
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2899
    "save contents into a file
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2900
     - ask user for filename using a fileSelectionBox."
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2901
3201
ce84e272c6bb code cleanup
Claus Gittinger <cg@exept.de>
parents: 3189
diff changeset
  2902
    saveAction value
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2903
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2904
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2905
saveAs:fileName
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2906
    "save the contents into a file named fileName.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2907
     On error return false otherwise return true"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2908
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2909
    ^ self saveAs:fileName doAppend:false
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2910
!
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2911
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2912
saveAs:aFilename doAppend:doAppend
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2913
    "save the contents into a file named fileName;
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2914
     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
  2915
     contents - otherwise, it overwrites any previous file contents.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2916
     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
  2917
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2918
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:true
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2919
!
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2920
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2921
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2922
    "save the contents into a file named fileName;
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2923
     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
  2924
     contents - otherwise, it overwrites any previous file contents.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2925
     On error return false otherwise return true"
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2926
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2927
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:nil
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2928
!
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2929
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2930
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:eolMode
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2931
    "save the contents into a file named fileName;
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2932
     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
  2933
     contents - otherwise, it overwrites any previous file contents.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2934
     eolMode is one of #cr, #nl or #crlf.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2935
     On error return false otherwise return true."
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2936
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2937
    |filename msg|
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2938
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2939
    filename := aFilename asFilename.
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2940
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2941
    self withWriteCursorDo:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2942
        |aStream|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2943
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2944
        (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2945
            msg := resources
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2946
                        stringWithCRs:'Refused to write file ''%1'' !!\(ST/X internal permission check)'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2947
                        with:filename name.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2948
        ] ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2949
            [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2950
                doAppend ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2951
                    aStream := filename appendingWriteStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2952
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2953
                    UserPreferences current generateBackupFileWhenSaving ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2954
                        filename exists ifTrue:[
6084
495039449826 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6059
diff changeset
  2955
                            filename moveTo:filename asBackupFilename.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2956
                        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2957
                    ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2958
                    aStream := filename newReadWriteStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2959
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2960
                aStream eolMode:eolMode.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2961
                self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2962
                aStream syncData; close.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2963
                contentsWasSaved := true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2964
                defaultFileNameForFileDialog := filename.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2965
            ] on:FileStream openErrorSignal do:[:ex|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2966
                msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2967
                                with:filename name
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2968
                                with:FileStream lastErrorString.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2969
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2970
        ].
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2971
    ].
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2972
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2973
    msg notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2974
        Dialog warn:msg.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2975
        ^ false
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2976
    ].
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2977
    ^ true
916
4201c9c2a4f0 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  2978
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2979
    "Modified: / 27-07-2012 / 09:45:13 / cg"
6084
495039449826 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6059
diff changeset
  2980
    "Modified: / 09-02-2017 / 13:30:41 / stefan"
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2981
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2982
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2983
search
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2984
    "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
  2985
     - 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
  2986
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2987
    self openSearchBoxAndSearch
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2988
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2989
    "Modified: / 11-07-2006 / 11:18:38 / fm"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2990
    "Modified: / 08-03-2012 / 14:03:10 / cg"
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2991
!
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2992
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2993
search:patternArg ignoreCase:ign forward:fwd
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2994
    "search for a string without matching"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2995
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2996
    self search:patternArg ignoreCase:ign match: false forward:fwd
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2997
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2998
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2999
search:patternArg ignoreCase:ign match: match forward:fwd
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  3000
    |pattern|
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  3001
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  3002
    pattern := patternArg string.
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  3003
    pattern notEmpty ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3004
        self rememberSearchPattern:pattern.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3005
        "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3006
        "/ LastSearchWasMatch := match.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3007
        fwd ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3008
            lastSearchDirection := #backward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3009
            self searchBwd:pattern ignoreCase:ign match: match.          "    backward search with match is not yet available  "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3010
        ] ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3011
            lastSearchDirection := #forward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3012
            self searchFwd:pattern ignoreCase:ign match: match.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3013
        ]
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  3014
    ]
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  3015
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  3016
    "Created: / 11-07-2006 / 11:18:04 / fm"
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3017
    "Modified: / 23-03-2012 / 12:12:07 / cg"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3018
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3019
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3020
searchUsingSpec:aSearchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3021
    self rememberSearchPattern:(aSearchSpec pattern).
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3022
    "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3023
    "/ LastSearchWasMatch := match.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3024
    aSearchSpec forward ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3025
        lastSearchDirection := #backward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3026
        self searchBwdUsingSpec:aSearchSpec
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3027
    ] ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3028
        lastSearchDirection := #forward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3029
        self searchFwdUsingSpec:aSearchSpec
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3030
    ]
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3031
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3032
    "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
  3033
    "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
  3034
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3035
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3036
searchVariableVisible
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3037
    "search variable option in searchbox visible?
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3038
     (only true for codeview2's textview)"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3039
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3040
    ^ false
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3041
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3042
    "Created: / 08-03-2012 / 14:01:24 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3043
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3044
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3045
searchVariableWithSyntaxElement:syntaxElementForVariable forward:fwd
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  3046
    "this only works for CodeView2::TextView, which supports syntaxElements.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  3047
     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
  3048
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  3049
    |el el2|
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3050
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3051
    lastSearchWasVariableSearch := true.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3052
    el := fwd
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3053
        ifTrue:[syntaxElementForVariable nextElement]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3054
        ifFalse:[syntaxElementForVariable previousElement].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3055
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3056
    el notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3057
        "bug workaround"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3058
        (el start = syntaxElementForVariable start) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3059
            el2 := fwd
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3060
                ifTrue:[el nextElement]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3061
                ifFalse:[el previousElement].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3062
            el2 notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3063
                el := el2
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3064
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3065
        ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3066
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3067
    el notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3068
        self selectFromCharacterPosition:el start to:el stop.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3069
        self makeLineVisible:(self lineOfCharacterPosition:el start).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3070
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3071
        self showNotFound
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3072
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3073
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3074
    "Created: / 08-03-2012 / 14:08:20 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3075
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3076
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3077
syntaxElementForSelectedVariable
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3078
    "for a better search; ignored here, but redefined in CodeView2"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3079
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3080
    ^ nil
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3081
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3082
    "Created: / 08-03-2012 / 14:20:27 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3083
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3084
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3085
syntaxElementForVariableUnderCursor
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3086
    "for a better search; ignored here, but redefined in CodeView2"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3087
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3088
    ^ nil
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3089
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3090
    "Created: / 08-03-2012 / 12:45:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3091
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3092
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3093
!TextView methodsFor:'native widget support'!
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3094
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3095
nativeWindowType
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3096
    "return a symbol describing my native window type
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  3097
     (may be used internally by the device as a native window creation hint,
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  3098
      if the device supports native windows)"
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3099
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3100
    ^ #TextView
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3101
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3102
    "Created: 2.5.1997 / 14:41:00 / cg"
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3103
! !
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3104
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3105
!TextView methodsFor:'private'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3106
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  3107
currentSelectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  3108
    ^  selectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  3109
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  3110
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  3111
currentSelectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  3112
    ^ selectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  3113
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  3114
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3115
fileOutContentsOn:aStream
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3116
    "save contents on a stream, replacing leading spaces by tab-characters."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3117
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3118
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3119
        fileOutContentsOn:aStream
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3120
        compressTabs:true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3121
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3122
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3123
fileOutContentsOn:aStream compressTabs:compressTabs
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3124
    "save contents on a stream. If compressTabs is true,
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3125
     leading spaces will be replaced by tab-characters in the output."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3126
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3127
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3128
        fileOutContentsOn:aStream
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3129
        compressTabs:compressTabs
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3130
        encoding:nil
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  3131
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  3132
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  3133
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
  3134
    "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
  3135
     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
  3136
2877
cdaea8ccd364 encoding
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  3137
    |startNr nLines string encoder|
cdaea8ccd364 encoding
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  3138
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3139
    self removeTrailingWhitespace.
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3140
5658
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  3141
    "/ This is now obsolete, as we are always using unicode internally.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  3142
    "/ 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
  3143
    encoder := CharacterEncoder encoderToEncodeFrom:gc characterEncoding into:encodingSymOrNil.
4455
febe97112d50 changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  3144
    encoder isNullEncoder ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3145
        (list contains:[:lineOrNil|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3146
                            |s|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3147
                            lineOrNil notNil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3148
                            and:[(s := lineOrNil string string) isWideString
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3149
                            and:[s asSingleByteStringIfPossible isWideString]]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3150
                       ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3151
        ) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3152
            (Dialog confirm:'The text contains non-8bit characters. Encode as UTF8?') ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3153
                ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3154
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3155
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3156
        encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8
4455
febe97112d50 changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  3157
    ].
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  3158
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  3159
    aStream isFileStream ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3160
        "on some systems, writing linewise is very slow (via NFS)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3161
         therefore we convert to a string and write it in big chunks.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3162
         To avoid creating huge strings, we do it in blocks of 1000 lines,
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3163
         limiting temporary string creation to about 50-80k.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3164
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3165
        startNr := 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3166
        nLines := list size.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3167
        (aStream eolMode notNil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3168
        and:[aStream eolMode ~= #nl]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3169
            "/ must do it lineWise ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3170
            list do:[:line |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3171
                line notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3172
                    encoder encodeString:line withTabs on:aStream
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3173
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3174
                aStream cr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3175
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3176
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3177
            [startNr <= nLines] whileTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3178
                string := list
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3179
                            asStringWithCRsFrom:startNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3180
                            to:((startNr + 1000) min:nLines)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3181
                            compressTabs:compressTabs.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3182
                encoder encodeString:string string on:aStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3183
                startNr := startNr + 1000 + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3184
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3185
        ].
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  3186
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3187
        list do:[:aLine |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3188
            aLine notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3189
                encoder encodeString:aLine on:aStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3190
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3191
            aStream cr.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3192
        ]
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  3193
    ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3194
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  3195
    "Modified: 8.6.1996 / 11:50:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3196
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3197
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  3198
getFontParameters
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  3199
    "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
  3200
     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
  3201
     line separation. This is required, to allow for proper handling of
4779
9f7633fc5583 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4767
diff changeset
  3202
     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
  3203
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3204
    |italicFont boldFont font|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3205
5820
7dafda8e0ce8 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5791
diff changeset
  3206
    font := gc deviceFont.
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3207
    "/ do we really need this info now?
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3208
    "/ on unix, it seems to work with the next two lines commented;
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3209
    "/ 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
  3210
    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
  3211
    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
  3212
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3213
    fontHeight := font height.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3214
    fontAscent := font ascent.
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3215
    fontWidth := font width.
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3216
    fontIsFixedWidth := font isFixedWidth.
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3217
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3218
    "/ fA := font maxAscent.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3219
    italicFont notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3220
        fontHeight := fontHeight max:(italicFont height).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3221
        fontAscent := fontAscent max:(italicFont ascent).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3222
        fontIsFixedWidth := fontIsFixedWidth and:[ italicFont isFixedWidth ]
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3223
    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3224
    boldFont notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3225
        fontHeight := fontHeight max:(boldFont height).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3226
        fontAscent := fontAscent max:(boldFont ascent).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3227
        fontIsFixedWidth := fontIsFixedWidth and:[ boldFont isFixedWidth ]
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3228
    ].
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3229
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  3230
    includesNonStrings == true ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3231
        "/ for now, we do not support variable height entries ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3232
        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
  3233
    ].
4579
3a5a72358a0a class: TextView
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
  3234
    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
  3235
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  3236
    "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
  3237
    "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
  3238
!
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  3239
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3240
highlightLineSpacing
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3241
    "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
  3242
     false if it remains white.
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3243
     false for selection in list views; true for edit/text views"
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3244
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3245
    ^ true
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3246
!
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3247
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3248
isClosingParenthesis:ch
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3249
    ((parenthesisSpecification at:#close) includes:ch) ifTrue:[^ true].
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3250
    ^ ')]}' includes:ch
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3251
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3252
    "Modified: / 12-02-2012 / 08:37:01 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3253
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3254
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3255
isOpeningParenthesis:ch
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3256
    ((parenthesisSpecification at:#open) includes:ch) ifTrue:[^ true].
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3257
    ^ '([{' includes:ch
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3258
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3259
    "Modified: / 12-02-2012 / 08:37:11 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3260
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3261
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3262
rememberSearchPattern:pattern
2691
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  3263
    |nRemembered patternString|
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  3264
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3265
    self clearSearchAction.
2813
ec8e83691849 forget searchAction, when a new pattern-search is done
Claus Gittinger <cg@exept.de>
parents: 2811
diff changeset
  3266
2691
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  3267
    patternString := pattern string.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3268
3270
e3ed37e15f9d oops - last-searchpatterns handling removed the wrong one.
Claus Gittinger <cg@exept.de>
parents: 3258
diff changeset
  3269
    nRemembered := NumRememberedSearchPatterns ? 20.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3270
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3271
    LastSearchPatterns isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3272
        LastSearchPatterns := OrderedCollection new.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3273
    ].
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3274
    "/ move to top or addFirst
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  3275
    (LastSearchPatterns includes:patternString) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3276
        LastSearchPatterns remove:patternString.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3277
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3278
        LastSearchPatterns size > nRemembered ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3279
            LastSearchPatterns removeLast
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3280
        ]
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3281
    ].
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  3282
    LastSearchPatterns addFirst:patternString.
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  3283
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  3284
    "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
  3285
!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3286
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3287
removeTrailingWhitespace
3001
d9877eeb59f5 *** empty log message ***
ca
parents: 2992
diff changeset
  3288
    list isNil ifTrue:[^self].
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3289
    list keysAndValuesDo:[:lineNR :line |
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3290
        |l|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3291
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3292
        line notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3293
            l := line withoutTrailingSeparators.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3294
            list at:lineNR put:l.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3295
        ]
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3296
    ].
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3297
!
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3298
4009
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3299
resetVariablesBeforeNewSearch
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3300
    "clear the autosearch action, when the first pattern is searched for"
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3301
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3302
    searchAction := nil.
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3303
!
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3304
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3305
scrollSelectDown
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3306
    "auto scroll downwards while selecting 
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3307
     (i.e. when the mouse is down, and moved out of the window to the bottom)
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3308
     scroll and reinstall timed-block.
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3309
     Adjust the selectionStartLine"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3310
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3311
    |prevEndLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3312
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3313
    "just to make certain, that we actually have a selection..."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3314
    selectionEndLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3315
6343
38dfd16a2888 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6340
diff changeset
  3316
    self scrollDownLines:1.
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
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3319
    prevEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3320
    selectionEndLine := firstLineShown + nFullLinesShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3321
    selectionEndCol := 0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3322
    prevEndLine to:selectionEndLine do:[:lineNr |
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3323
        self redrawLine:lineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3324
    ].
5235
888c50995301 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5120
diff changeset
  3325
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  3326
    self selectionChanged.
6343
38dfd16a2888 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6340
diff changeset
  3327
38dfd16a2888 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6340
diff changeset
  3328
    "Modified: / 13-06-2018 / 23:43:28 / Claus Gittinger"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3329
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3330
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3331
scrollSelectLeft
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3332
    "auto scroll to the left while selecting 
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3333
     (i.e. when the mouse is down, and moved out of the window to the left)
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3334
     scroll and reinstall timed-block.
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3335
     Adjust the selectionStartColumn."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3336
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3337
    |prevStartLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3338
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3339
    "just to make certain, that we actually have a selection..."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3340
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3341
    selectionStartCol isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3342
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3343
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3344
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3345
    selectionStartCol := selectionStartCol - 1 max:1.
6340
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3346
    true "false" ifTrue:[
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3347
        self selectionChanged. self repairDamage.
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3348
        self scrollLeft.       self repairDamage. 
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3349
    ] ifFalse:[
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3350
        self scrollLeft.       
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3351
        self selectionChanged.
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3352
    ].    
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3353
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3354
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
6340
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3355
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3356
    "Modified: / 13-06-2018 / 22:54:24 / Claus Gittinger"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3357
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3358
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3359
scrollSelectRight
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3360
    "auto scroll to the right while selecting 
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3361
     (i.e. when the mouse is down, and moved out of the window to the right)
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3362
     scroll and reinstall timed-block.
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3363
     Adjust the selectionEndColumn."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3364
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3365
    |prevEndCol firstVisibleCol endLine|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3366
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3367
    "just to make certain, that we actually have a selection..."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3368
    selectionEndCol isNil ifTrue:[^ self].
4169
11d3b7a3e713 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4160
diff changeset
  3369
    selectionEndLine isNil ifTrue:[^ self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3370
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3371
    prevEndCol := selectionEndCol.
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3372
    selectionEndCol := (selectionEndCol + 1) min:(self listAt:selectionEndLine) size.
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3373
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3374
    endLine := self listLineToVisibleLine:selectionEndLine.
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3375
    endLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3376
        firstVisibleCol := self colOfX:1 inVisibleLine:endLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3377
        selectionEndCol < firstVisibleCol ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3378
            "/ scrolling faster than selection advances...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3379
            selectionEndCol := firstVisibleCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3380
        ].
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3381
    ].
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3382
6340
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3383
    self selectionChanged. false ifTrue:[ self repairDamage ].
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3384
    self scrollRight.      false ifTrue:[ self repairDamage ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3385
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3386
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3387
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3388
    "Modified: / 05-08-2010 / 21:25:56 / cg"
6340
48cf090e4539 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6324
diff changeset
  3389
    "Modified: / 13-06-2018 / 22:52:49 / Claus Gittinger"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3390
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3391
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3392
scrollSelectUp
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3393
    "auto scroll upwards while selecting 
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3394
     (i.e. when the mouse is down, and moved out of the window to the top)
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3395
     scroll and reinstall timed-block.
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3396
     Adjust the selectionStartLine"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3397
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3398
    |prevStartLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3399
6294
0af3d976211f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6292
diff changeset
  3400
    "just to make certain, that we actually have a selection..."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3401
    selectionStartLine isNil ifTrue:[^ self].
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
    self scrollUp.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3404
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3405
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3406
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3407
    selectionStartLine := firstLineShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3408
    selectionStartCol := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3409
    selectionStartLine to:prevStartLine do:[:lineNr |
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3410
        self redrawLine:lineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3411
    ].
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3412
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  3413
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3414
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3415
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3416
stopScrollSelect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3417
    "stop auto scroll; deinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3418
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3419
    autoScrollBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3420
        Processor removeTimedBlock:autoScrollBlock.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3421
        self compressMotionEvents:true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3422
        autoScrollBlock := nil.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3423
        autoScrollDeltaT := nil
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3424
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3425
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3426
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3427
textChanged
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3428
    self isNativeWidget ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3429
        gc drawableId notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3430
            device changeText:self contents in:gc drawableId
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3431
        ]
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3432
    ].
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3433
    super textChanged
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3434
!
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3435
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3436
widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3437
    "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
  3438
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3439
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3440
        "/ if there is a selection which covers multiple lines,
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3441
        "/ we have to scroll the whole width (to include the selection-rectangle)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3442
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3443
        (lastLine < selectionStartLine) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3444
            (firstLine > selectionEndLine) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3445
                ^ width
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3446
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3447
        ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3448
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3449
    ^ super widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3450
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3451
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3452
!TextView methodsFor:'queries'!
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3453
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3454
hasSearchActionSelection
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3455
    "Here we fake the use of typeOfSelection which is really in EditTextView"
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3456
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3457
    ^ false
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3458
!
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3459
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3460
specClass
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  3461
    "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
  3462
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3463
    self class == TextView ifTrue:[^ TextEditorSpec].
1046
10da5b6bd390 specClass query
ca
parents: 1028
diff changeset
  3464
    ^ super specClass
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3465
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  3466
    "Modified: / 31.10.1997 / 19:48:35 / cg"
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3467
! !
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3468
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3469
!TextView methodsFor:'redrawing'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3470
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3471
clearMarginOfVisibleLine:visLine with:color
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3472
    "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
  3473
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3474
    (leftMargin ~~ 0) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3475
        viewOrigin x <= margin ifTrue:[
6059
862a2c65691b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5955
diff changeset
  3476
            gc paint:color.
6286
05d5d5f8bc54 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6282
diff changeset
  3477
            gc fillRectangleX:(margin-viewOrigin x) y:(self yOfVisibleLine:visLine)-(lineSpacing//2)
6059
862a2c65691b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5955
diff changeset
  3478
               width:leftMargin height:fontHeight
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3479
        ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3480
    ]
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3481
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3482
    "Created: 6.3.1996 / 14:22:55 / cg"
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3483
!
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3484
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3485
drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3486
    startVisLineNr to:endVisLineNr do:[:visLine |
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3487
        self drawVisibleLineSelected:visLine
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3488
    ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3489
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3490
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3491
drawVisibleLineSelected:visLineNr
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3492
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3493
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3494
        inVisible:visLineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3495
        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
  3496
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3497
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3498
drawVisibleLineSelected:visLineNr col:col
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3499
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3500
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3501
        inVisible:visLineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3502
        col:col
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3503
        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
  3504
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3505
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3506
drawVisibleLineSelected:visLineNr from:selectionStartCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3507
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3508
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3509
        inVisible:visLineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3510
        from:selectionStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3511
        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
  3512
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3513
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3514
drawVisibleLineSelected:visLineNr from:startCol to:endCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3515
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3516
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3517
        inVisible:visLineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3518
        from:startCol to:endCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3519
        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
  3520
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3521
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3522
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3523
    "redraw a visible line range"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3524
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3525
    |startLine endLine specialCare end selVisStart line1 line2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3526
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3527
    shown ifFalse:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3528
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3529
    end := endVisLineNr.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3530
    (end > nLinesShown) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3531
        end := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3532
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3533
2740
892dfb6b0da1 kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  3534
    selectionEndLine isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3535
        selectionStartLine := nil
2740
892dfb6b0da1 kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  3536
    ].
2735
5ba2010aefa4 *** empty log message ***
penk
parents: 2730
diff changeset
  3537
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3538
    selectionStartLine isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3539
        specialCare := false
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3540
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3541
        startLine := self visibleLineToAbsoluteLine:startVisLineNr.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3542
        (startLine > selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3543
            specialCare := false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3544
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3545
            endLine := self visibleLineToAbsoluteLine:end.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3546
            (endLine < selectionStartLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3547
                specialCare := false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3548
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3549
                specialCare := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3550
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3551
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3552
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3553
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3554
    "easy: nothing is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3555
    specialCare ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3556
        super redrawFromVisibleLine:startVisLineNr to:end.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3557
        ^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3558
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3559
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3560
    "easy: all is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3561
    ((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3562
        self drawSelectedFromVisibleLine:startVisLineNr to:end.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3563
        ^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3564
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3565
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3566
    (selectionStartLine >= firstLineShown) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3567
        "draw unselected top part"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3568
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3569
        selVisStart := self listLineToVisibleLine:selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3570
        super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3571
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3572
        "and first partial selected line"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3573
        self redrawVisibleLine:selVisStart.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3574
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3575
        "rest starts after this one"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3576
        line1 := selVisStart + 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3577
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3578
        line1 := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3579
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3580
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3581
    (line1 > end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3582
    (line1 < startVisLineNr) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3583
        line1 := startVisLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3584
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3585
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3586
    "draw middle part of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3587
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3588
    (selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3589
        line2 := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3590
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3591
        line2 := (self listLineToVisibleLine:selectionEndLine) - 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3592
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3593
    (line2 > end) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3594
        line2 := end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3595
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3596
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3597
    self drawSelectedFromVisibleLine:line1 to:line2.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3598
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3599
    (line2 >= end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3600
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3601
    "last line of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3602
    self redrawVisibleLine:(line2 + 1).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3603
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3604
    ((line2 + 2) <= end) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3605
        super redrawFromVisibleLine:(line2 + 2) to:end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3606
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3607
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3608
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3609
redrawVisibleLine:visLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3610
    "redraw visible line lineNr"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3611
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3612
    |line|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3613
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3614
    (selectionStartLine notNil and:[selectionEndLine notNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3615
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3616
        line := self visibleLineToAbsoluteLine:visLineNr.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3617
        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3618
            (line == selectionStartLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3619
                (line == selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3620
                    "it's part-of-single-line selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3621
                    self clearMarginOfVisibleLine:visLineNr with:bgColor.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3622
                    (selectionStartCol > 1) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3623
                        super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3624
                    ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3625
                    self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3626
                    super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3627
                    ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3628
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3629
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3630
                "it's the first line of a multi-line selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3631
                (selectionStartCol ~~ 1) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3632
                    self clearMarginOfVisibleLine:visLineNr with:bgColor.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3633
                    super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3634
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3635
                    viewOrigin x == 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3636
                        self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3637
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3638
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3639
                self drawVisibleLineSelected:visLineNr from:selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3640
                ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3641
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3642
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3643
            (line == selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3644
                "it's the last line of a multi-line selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3645
                (selectionEndCol == 0) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3646
                    ^ super redrawVisibleLine:visLineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3647
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3648
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3649
                self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3650
                self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3651
                super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3652
                ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3653
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3654
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3655
            "it's a full line in a multi-line selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3656
            self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3657
            self drawVisibleLineSelected:visLineNr.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3658
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3659
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3660
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3661
    super redrawVisibleLine:visLineNr
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3662
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3663
    "Modified: 6.3.1996 / 14:22:19 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3664
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3665
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3666
redrawVisibleLine:visLine col:col
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3667
    "redraw single character at col in visible line lineNr."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3668
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3669
    |line|
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3670
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3671
    "/
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3672
    "/ care for selection
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3673
    "/
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3674
    (selectionStartLine notNil and:[selectionEndLine notNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3675
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3676
        line := self visibleLineToAbsoluteLine:visLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3677
        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3678
            ((line == selectionStartLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3679
            and: [col < selectionStartCol]) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3680
                ((line == selectionEndLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3681
                and: [col > selectionEndCol]) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3682
                    "its in the selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3683
                    self drawVisibleLineSelected:visLine col:col.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3684
                    ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3685
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3686
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3687
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3688
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3689
    self drawVisibleLine:visLine col:col with:fgColor and:bgColor
1496
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3690
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3691
    "Modified: / 22.4.1998 / 08:53:05 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3692
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3693
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3694
redrawVisibleLine:visLine from:startCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3695
    "redraw visible line lineNr from startCol to end of line"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3696
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3697
    |col line|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3698
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3699
    col := startCol.
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3700
    col == 0 ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3701
        col := 1.
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3702
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3703
2778
223915a2d6a4 kludge workaround selectionEndLine is sometimes nil
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  3704
    (selectionStartLine notNil and:[selectionEndLine notNil]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3705
        line := self visibleLineToAbsoluteLine:visLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3706
        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3707
            ((line == selectionStartLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3708
             or:[line == selectionEndLine]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3709
                "since I'm lazy, redraw full line"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3710
                self redrawVisibleLine:visLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3711
                ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3712
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3713
            "the line is fully within the selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3714
            self drawVisibleLineSelected:visLine from:col.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3715
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3716
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3717
    ].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3718
    super redrawVisibleLine:visLine from:col
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3719
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3720
    "Modified: 6.3.1996 / 14:19:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3721
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3722
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3723
redrawVisibleLine:visLine from:startCol to:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3724
    "redraw visible line lineNr from startCol to endCol"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3725
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3726
    |line allOut allIn leftCol rightCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3727
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3728
    line := self visibleLineToAbsoluteLine:visLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3729
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3730
    allIn := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3731
    allOut := false.
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3732
    (selectionStartLine isNil or:[selectionEndLine isNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3733
    or:[selectionStartCol isNil or:[selectionEndCol isNil]]]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3734
        allOut := true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3735
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3736
        (line between:selectionStartLine and:selectionEndLine) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3737
            allOut := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3738
        ] ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3739
            (selectionStartLine == selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3740
                ((endCol < selectionStartCol)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3741
                or:[startCol > selectionEndCol]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3742
                    allOut := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3743
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3744
                    ((startCol >= selectionStartCol)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3745
                    and:[endCol <= selectionEndCol]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3746
                        allIn := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3747
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3748
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3749
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3750
                (line == selectionStartLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3751
                    (endCol < selectionStartCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3752
                        allOut := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3753
                    ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3754
                        (startCol >= selectionStartCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3755
                            allIn := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3756
                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3757
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3758
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3759
                    (line == selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3760
                        (startCol > selectionEndCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3761
                            allOut := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3762
                        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3763
                            (endCol <= selectionEndCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3764
                                allIn := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3765
                            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3766
                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3767
                    ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3768
                        allIn := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3769
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3770
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3771
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3772
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3773
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3774
    allOut ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3775
        super redrawVisibleLine:visLine from:startCol to:endCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3776
        ^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3777
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3778
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3779
    allIn ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3780
        self drawVisibleLineSelected:visLine from:startCol to:endCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3781
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3782
        "redraw part before selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3783
        ((line == selectionStartLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3784
         and:[startCol <= selectionStartCol]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3785
            super redrawVisibleLine:visLine from:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3786
                                              to:(selectionStartCol - 1).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3787
            leftCol := selectionStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3788
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3789
            leftCol := startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3790
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3791
        "redraw selected part"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3792
        (selectionEndLine > line) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3793
            rightCol := endCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3794
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3795
            rightCol := selectionEndCol min:endCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3796
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3797
        self drawVisibleLineSelected:visLine from:leftCol to:rightCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3798
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3799
        "redraw part after selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3800
        (rightCol < endCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3801
            super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3802
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3803
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3804
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3805
    "special care for first and last line of selection:
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3806
     must handle margin also"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3807
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3808
    ((line == selectionEndLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3809
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3810
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3811
    ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3812
        self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3813
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3814
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3815
    ((line == selectionStartLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3816
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3817
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3818
    ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3819
        self clearMarginOfVisibleLine:visLine with:bgColor.
4602
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3820
    ].
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3821
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3822
    ((line > selectionStartLine)
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3823
    and:[(startCol == 1)
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3824
    and:[selectionStartLine < selectionEndLine
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3825
    and:[line < selectionEndLine]]])
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3826
    ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3827
        self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3828
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3829
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3830
    "Modified: 6.3.1996 / 14:23:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3831
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3832
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3833
!TextView methodsFor:'searching'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3834
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3835
clearSearchAction
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3836
    searchAction := nil.
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3837
!
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3838
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3839
scanFor:aCharacter fromLine:startLine col:startCol forward:forward
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3840
                     ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3841
                  ifNotFound:notFoundBlock
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3842
    "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
  3843
     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
  3844
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3845
    |lineString
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3846
     line   "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3847
     col    "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3848
     delta  "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3849
     endCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3850
     cc
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3851
     maxLine "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3852
      |
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3853
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3854
    col := startCol.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3855
    line := startLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3856
    forward ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3857
        delta := 1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3858
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3859
        delta := -1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3860
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3861
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3862
    lineString := list at:line.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3863
    maxLine := list size.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3864
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3865
    col := col + delta.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3866
    [true] whileTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3867
        lineString notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3868
            forward ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3869
                endCol := lineString size.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3870
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3871
                endCol := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3872
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3873
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3874
            col to:endCol by:delta do:[:rCol |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3875
                cc := lineString at:rCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3876
                cc == aCharacter ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3877
                    ^ foundBlock value:line value:rCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3878
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3879
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3880
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3881
        line := line + delta.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3882
        (line < 1 or:[line > maxLine]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3883
            ^ notFoundBlock value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3884
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3885
        lineString := list at:line.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3886
        forward ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3887
            col := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3888
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3889
            col := lineString size
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3890
        ]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3891
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3892
    "not reached"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3893
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3894
    "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
  3895
    "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
  3896
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3897
3802
sr
parents: 3792
diff changeset
  3898
searchAction
sr
parents: 3792
diff changeset
  3899
    ^ searchAction
sr
parents: 3792
diff changeset
  3900
!
sr
parents: 3792
diff changeset
  3901
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3902
searchAction:aSearcherOrSearchBlock
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3903
    searchAction := aSearcherOrSearchBlock
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3904
!
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3905
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3906
searchAgainInSameDirection
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3907
    "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
  3908
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3909
    |ign match|
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3910
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  3911
    searchBarActionBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3912
        searchBarActionBlock value:#forward value:self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3913
        ^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3914
    ].
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3915
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3916
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3917
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3918
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3919
    self setSearchPatternWithMatchEscapes: match.
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3920
    lastSearchPattern notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3921
        lastSearchDirection == #backward ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3922
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3923
                searchBwd:lastSearchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3924
                ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3925
                match: match
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3926
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3927
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3928
                searchFwd:lastSearchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3929
                ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3930
                match: match
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3931
        ]
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3932
    ]
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3933
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3934
    "Created: / 03-05-1999 / 15:02:16 / cg"
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3935
    "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
  3936
!
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3937
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3938
searchBwd
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3939
    "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
  3940
     If found, position cursor"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3941
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3942
    |ign selectedVariable|
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  3943
2811
3a7aed97fd76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  3944
    searchAction notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3945
        "/autosearch is cleared whenever there is search with user selection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3946
        (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
4178
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3947
    ].
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3948
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3949
    searchAction notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3950
        "/confusing: this is for autosearch of variables (browse variable uses, for example)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3951
        self searchUsingSearchAction:#backward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3952
        ^ self.
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3953
    ].
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  3954
    searchBarActionBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3955
        searchBarActionBlock value:#backward value:self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3956
        ^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3957
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3958
    lastSearchWasVariableSearch ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3959
        selectedVariable := self syntaxElementForSelectedVariable.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3960
        selectedVariable notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3961
            self searchVariableWithSyntaxElement:selectedVariable forward:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3962
            ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3963
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3964
        lastSearchWasVariableSearch := false.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3965
    ].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3966
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3967
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  3968
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3969
    self setSearchPatternWithMatchEscapes: false.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3970
    lastSearchPattern isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3971
        LastSearchPatterns size > 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3972
            lastSearchPattern := LastSearchPatterns first
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3973
        ]
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3974
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3975
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3976
    lastSearchPattern notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3977
        lastSearchDirection := #backward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3978
        self rememberSearchPattern:lastSearchPattern.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3979
        self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3980
            searchBwd:lastSearchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3981
            ignoreCase:ign
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3982
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3983
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3984
    "Modified: / 08-03-2012 / 14:26:25 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3985
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3986
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3987
searchBwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3988
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3989
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3990
    self searchBwd:pattern ifAbsent:[self showNotFound].
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3991
"/    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3992
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3993
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3994
    "Modified: / 21-09-2006 / 16:48:29 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3995
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3996
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3997
searchBwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3998
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3999
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4000
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4001
        searchBwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4002
                                        pattern:pattern)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4003
        ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4004
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4005
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4006
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4007
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4008
searchBwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4009
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4010
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4011
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4012
        searchBwd:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4013
        ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4014
        ifAbsent:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4015
                    self sensor compressKeyPressEventsWithKey:#FindPrev.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4016
                    self showNotFound
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4017
                 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4018
    "/ lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4019
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4020
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4021
    "Created: / 13-09-1997 / 06:18:00 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4022
    "Modified: / 23-03-2012 / 12:10:25 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4023
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4024
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4025
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4026
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4027
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4028
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4029
        searchBwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4030
                                        pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4031
                                        ignoreCase:ign)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4032
        ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4033
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4034
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4035
    "Created: 13.9.1997 / 06:18:41 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4036
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4037
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4038
searchBwd:pattern ignoreCase:ign match: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4039
    "do a backward search.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4040
    match pattern functionality is not yet available for backward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4041
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4042
    "/ lastSearchWasMatch := match.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4043
    self searchBwd:pattern ignoreCase:ign.
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4044
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4045
    "Modified: / 23-03-2012 / 12:12:44 / cg"
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4046
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4047
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4048
searchBwdUsingSpec:searchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4049
    "do a backward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4050
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4051
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4052
        searchBwdUsingSpec:searchSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4053
        ifAbsent:[self showNotFound].
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4054
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4055
"/    lastSearchIgnoredCase := false.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4056
    lastSearchPattern := searchSpec pattern string
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4057
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4058
    "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
  4059
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4060
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4061
searchBwdUsingSpec:searchSpec ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4062
    "do a backward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4063
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4064
    |pos startLine startCol|
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4065
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4066
    pos :=  self startPositionForSearchBackward.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4067
    startLine := pos y.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4068
    startCol := pos x.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4069
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4070
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4071
        searchBackwardUsingSpec:searchSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4072
        startingAtLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4073
        ifFound:[:line :col :endColOrNil|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4074
            self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4075
        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4076
        ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4077
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4078
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4079
searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4080
    "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
  4081
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4082
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4083
        searchForMatchingParenthesisFromLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4084
        ifFound:[:line :col |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4085
                  self selectFromLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4086
                               toLine:line col:col]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4087
        ifNotFound:[self showNotFound]
6264
3b7b675cbdf8 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6261
diff changeset
  4088
        onError:[self beepInEditor]
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4089
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4090
    "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
  4091
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4092
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4093
searchForMatchingParenthesisFromLine:startLine col:startCol
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4094
                     ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4095
                  ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4096
                     onError:failBlock
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4097
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4098
    "search for a matching parenthesis; start search with character at startLine/startCol.
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4099
     Search for the corresponding character is done forward if it's an opening,
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4100
     backwards if it's a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4101
     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
  4102
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4103
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4104
    ^ self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4105
        searchForMatchingParenthesisFromLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4106
        ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4107
        ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4108
        onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4109
        ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' )
3478
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  4110
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  4111
    "Modified: / 12-04-2007 / 11:24:24 / cg"
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4112
    "Modified (comment): / 13-02-2017 / 20:32:20 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4113
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4114
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4115
searchForMatchingParenthesisFromLine:startLine col:startCol
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4116
                     ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4117
                  ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4118
                     onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4119
                    ignoring:ignoreSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4120
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4121
    "search for a matching parenthesis; start search with character at startLine/startCol.
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4122
     Search for the corresponding character is done forward if it's an opening,
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4123
     backwards if it's a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4124
     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
  4125
     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
  4126
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4127
    ^ self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4128
        searchForMatchingParenthesisFromLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4129
        ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4130
        ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4131
        onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4132
        openingCharacters: (parenthesisSpecification at:#open)  "/ #( $( $[ ${ "$> $<")
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4133
        closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<")
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4134
        ignoredCharacters: ignoreSet
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4135
        specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4136
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4137
"/    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4138
"/     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4139
"/     ignoring
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4140
"/     line   "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4141
"/     col    "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4142
"/     delta  "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4143
"/     endCol "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4144
"/     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4145
"/     cc prevCC nextCC incSet decSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4146
"/     nesting "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4147
"/     maxLine "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4148
"/     ign skip anySet|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4149
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4150
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4151
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4152
"/    parChar := self characterAtLine:startLine col:startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4153
"/    i := charSet indexOf:parChar.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4154
"/    i == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4155
"/        ^ failBlock value   "not a parenthesis"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4156
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4157
"/    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
  4158
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4159
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4160
"/    col := startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4161
"/    line := startLine.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4162
"/    direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4163
"/        delta := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4164
"/        incSet := #( $( $[ ${ "$<" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4165
"/        decSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4166
"/    ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4167
"/        delta := -1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4168
"/        incSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4169
"/        decSet := #( $( $[ ${ "$<" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4170
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4171
"/    anySet := Set new.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4172
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4173
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4174
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4175
"/    nesting := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4176
"/    ignoring := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4177
"/    lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4178
"/    maxLine := list size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4179
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4180
"/    col := col + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4181
"/    [nesting ~~ 0] whileTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4182
"/        (lineString notNil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4183
"/        and:[lineString includesAny:anySet]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4184
"/            direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4185
"/                endCol := lineString size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4186
"/            ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4187
"/                endCol := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4188
"/            ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4189
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4190
"/            col to:endCol by:delta do:[:rCol |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4191
"/                runCol := rCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4192
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4193
"/                cc := lineString at:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4194
"/                runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4195
"/                    nextCC := lineString at:runCol+1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4196
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4197
"/                    nextCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4198
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4199
"/                runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4200
"/                    prevCC := lineString at:runCol-1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4201
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4202
"/                    prevCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4203
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4204
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4205
"/                ign := skip := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4206
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4207
"/                "/ check for comments.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4208
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4209
"/                ((cc == $" and:[nextCC == $/])
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4210
"/                or:[prevCC == $$ ]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4211
"/                    "/ do nothing
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4212
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4213
"/                    skip := true.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4214
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4215
"/                    ignoreSet do:[:ignore |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4216
"/                        ignore == cc ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4217
"/                            ign := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4218
"/                        ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4219
"/                            ignore isString ifTrue:[
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4220
"/                                cc == (ignore at:2) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4221
"/                                    runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4222
"/                                        (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
  4223
"/                                            skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4224
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4225
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4226
"/                                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4227
"/                                    cc == (ignore at:1) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4228
"/                                        runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4229
"/                                            (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
  4230
"/                                                skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4231
"/                                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4232
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4233
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4234
"/                                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4235
"/                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4236
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4237
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4238
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4239
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4240
"/                ign ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4241
"/                    ignoring := ignoring not
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4242
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4243
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4244
"/                ignoring ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4245
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4246
"/                        (incSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4247
"/                            nesting := nesting + 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4248
"/                        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4249
"/                            (decSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4250
"/                                nesting := nesting - 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4251
"/                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4252
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4253
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4254
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4255
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4256
"/                nesting == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4257
"/                    "check if legal"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4258
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4259
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4260
"/                        cc == closingChar ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4261
"/                            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4262
"/                        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4263
"/                        ^ foundBlock value:line value:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4264
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4265
"/                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4266
"/            ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4267
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4268
"/        line := line + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4269
"/        (line < 1 or:[line > maxLine]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4270
"/            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4271
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4272
"/        lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4273
"/        direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4274
"/            col := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4275
"/        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4276
"/            col := lineString size
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4277
"/        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4278
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4279
"/    ^ notFoundBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4280
3478
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  4281
    "Modified: / 12-04-2007 / 11:25:36 / cg"
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4282
    "Modified (comment): / 13-02-2017 / 20:32:30 / cg"
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4283
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4284
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4285
searchForMatchingParenthesisFromLine:startLine col:startCol
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4286
                     ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4287
                  ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4288
                     onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4289
           openingCharacters:openingCharacters
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4290
           closingCharacters:closingCharacters
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4291
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4292
    "search for a matching parenthesis; start search with character at startLine/startCol.
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4293
     Search for the corresponding character is done forward if it's an opening,
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4294
     backwards if it's a closing parenthesis.
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4295
     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
  4296
     If there is a nesting error, evaluate failBlock."
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4297
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4298
    ^ self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4299
        searchForMatchingParenthesisFromLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4300
        ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4301
        ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4302
        onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4303
        openingCharacters: openingCharacters
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4304
        closingCharacters: closingCharacters
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4305
        ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#())
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4306
        specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4307
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4308
"/    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4309
"/     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4310
"/     ignoring
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4311
"/     line   "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4312
"/     col    "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4313
"/     delta  "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4314
"/     endCol "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4315
"/     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4316
"/     cc prevCC nextCC incSet decSet
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4317
"/     nesting "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4318
"/     maxLine "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4319
"/     ign skip anySet|
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4320
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4321
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4322
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4323
"/    parChar := self characterAtLine:startLine col:startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4324
"/    i := charSet indexOf:parChar.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4325
"/    i == 0 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4326
"/        ^ failBlock value   "not a parenthesis"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4327
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4328
"/    direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4329
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4330
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4331
"/    col := startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4332
"/    line := startLine.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4333
"/    direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4334
"/        delta := 1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4335
"/        incSet := #( $( $[ ${ "$<" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4336
"/        decSet := #( $) $] $} "$>" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4337
"/    ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4338
"/        delta := -1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4339
"/        incSet := #( $) $] $} "$>" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4340
"/        decSet := #( $( $[ ${ "$<" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4341
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4342
"/    anySet := Set new.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4343
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4344
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4345
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4346
"/    nesting := 1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4347
"/    ignoring := false.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4348
"/    lineString := list at:line.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4349
"/    maxLine := list size.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4350
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4351
"/    col := col + delta.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4352
"/    [nesting ~~ 0] whileTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4353
"/        (lineString notNil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4354
"/        and:[lineString includesAny:anySet]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4355
"/            direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4356
"/                endCol := lineString size.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4357
"/            ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4358
"/                endCol := 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4359
"/            ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4360
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4361
"/            col to:endCol by:delta do:[:rCol |
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4362
"/                runCol := rCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4363
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4364
"/                cc := lineString at:runCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4365
"/                runCol < lineString size ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4366
"/                    nextCC := lineString at:runCol+1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4367
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4368
"/                    nextCC := nil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4369
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4370
"/                runCol > 1 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4371
"/                    prevCC := lineString at:runCol-1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4372
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4373
"/                    prevCC := nil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4374
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4375
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4376
"/                ign := skip := false.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4377
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4378
"/                "/ check for comments.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4379
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4380
"/                ((cc == $" and:[nextCC == $/])
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4381
"/                or:[prevCC == $$ ]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4382
"/                    "/ do nothing
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4383
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4384
"/                    skip := true.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4385
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4386
"/                    ignoreSet do:[:ignore |
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4387
"/                        ignore == cc ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4388
"/                            ign := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4389
"/                        ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4390
"/                            ignore isString ifTrue:[
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4391
"/                                cc == (ignore at:2) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4392
"/                                    runCol > 1 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4393
"/                                        (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4394
"/                                            skip := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4395
"/                                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4396
"/                                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4397
"/                                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4398
"/                                    cc == (ignore at:1) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4399
"/                                        runCol < lineString size ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4400
"/                                            (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4401
"/                                                skip := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4402
"/                                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4403
"/                                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4404
"/                                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4405
"/                                ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4406
"/                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4407
"/                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4408
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4409
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4410
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4411
"/                ign ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4412
"/                    ignoring := ignoring not
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4413
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4414
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4415
"/                ignoring ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4416
"/                    skip ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4417
"/                        (incSet includes:cc) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4418
"/                            nesting := nesting + 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4419
"/                        ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4420
"/                            (decSet includes:cc) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4421
"/                                nesting := nesting - 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4422
"/                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4423
"/                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4424
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4425
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4426
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4427
"/                nesting == 0 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4428
"/                    "check if legal"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4429
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4430
"/                    skip ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4431
"/                        cc == closingChar ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4432
"/                            ^ failBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4433
"/                        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4434
"/                        ^ foundBlock value:line value:runCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4435
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4436
"/                ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4437
"/            ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4438
"/        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4439
"/        line := line + delta.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4440
"/        (line < 1 or:[line > maxLine]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4441
"/            ^ failBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4442
"/        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4443
"/        lineString := list at:line.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4444
"/        direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4445
"/            col := 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4446
"/        ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4447
"/            col := lineString size
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4448
"/        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4449
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4450
"/    ^ notFoundBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4451
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4452
    "Modified: / 12-04-2007 / 11:25:36 / cg"
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4453
    "Modified (comment): / 13-02-2017 / 20:32:36 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4454
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4455
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4456
searchForMatchingParenthesisFromLine:startLine col:startCol
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4457
                     ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4458
                  ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4459
                     onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4460
           openingCharacters:openingCharacters
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4461
           closingCharacters:closingCharacters
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4462
           ignoredCharacters:ignoreSet
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4463
          specialEOLComment:eolCommentSequence
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4464
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4465
    "search for a matching parenthesis; start search with character at startLine/startCol.
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4466
     Search for the corresponding character is done forward if it's an opening,
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4467
     backwards if it's a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4468
     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
  4469
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4470
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4471
    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4472
     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4473
     ignoring
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4474
     line   "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4475
     col    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4476
     delta  "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4477
     endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4478
     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4479
     cc prevCC nextCC incSet decSet
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4480
     nesting 
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4481
     maxLine "{ Class: SmallInteger }"
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4482
     ign skip anySet
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4483
     eol1 eol2 inLineComment idx|
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4484
2772
4e04a3bf399f check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4485
    self assert:(openingCharacters size == closingCharacters size).
4e04a3bf399f check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4486
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4487
    charSet := openingCharacters , closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4488
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4489
    parChar := self characterAtLine:startLine col:startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4490
    i := charSet indexOf:parChar.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4491
    i == 0 ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4492
        ^ failBlock value   "not a parenthesis"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4493
    ].
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4494
3858
1fd3e63fb456 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3851
diff changeset
  4495
    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
  4496
    closingChar := (closingCharacters , openingCharacters) at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4497
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4498
    "nesting is a Stack containing {expected char . line number of found char} tuples"
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4499
    nesting := Stack new.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4500
    nesting push:{closingChar. startLine}.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4501
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4502
    eol1 := eolCommentSequence at:1 ifAbsent:nil.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4503
    eol2 := eolCommentSequence at:2 ifAbsent:nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4504
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4505
    col := startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4506
    line := startLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4507
    direction == #fwd ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4508
        delta := 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4509
        incSet := openingCharacters.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4510
        decSet := closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4511
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4512
        delta := -1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4513
        incSet := closingCharacters.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4514
        decSet := openingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4515
    ].
1454
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4516
    anySet := Set new.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4517
    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4518
    anySet := (anySet select:[:c | c isCharacter]) asString.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4519
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4520
    ignoring := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4521
    lineString := list at:line.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4522
    maxLine := list size.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4523
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4524
    col := col + delta.
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4525
    [nesting notEmpty] whileTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4526
        (lineString notNil and:[lineString includesAny:anySet]) ifTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4527
            inLineComment := false.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4528
            direction == #fwd ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4529
                endCol := lineString size.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4530
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4531
                endCol := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4532
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4533
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4534
            col to:endCol by:delta do:[:rCol |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4535
                runCol := rCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4536
                cc := lineString at:runCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4537
                runCol < lineString size ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4538
                    nextCC := lineString at:runCol+1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4539
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4540
                    nextCC := nil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4541
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4542
                runCol > 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4543
                    prevCC := lineString at:runCol-1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4544
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4545
                    prevCC := nil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4546
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4547
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4548
                ign := skip := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4549
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4550
                (cc == eol1 and:[nextCC == eol2]) ifTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4551
                    "/ check for comments, do not search for a matching '"' in a "/ comment.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4552
                    inLineComment := skip := true.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4553
                    [nesting top second = line] whileTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4554
                        "while doing backward searching we have found a line comment
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4555
                         containing a opening/closing char"
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4556
                        nesting pop.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4557
                    ].
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4558
                ] ifFalse:[prevCC == $$ ifTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4559
                    "/ do not search for a matching peer for $( or $[...
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4560
                    skip := true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4561
                ] ifFalse:[
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4562
                    ignoreSet do:[:eachCharToIgnore |
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4563
                        eachCharToIgnore == cc ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4564
                            ign := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4565
                        ] ifFalse:[
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4566
                            eachCharToIgnore isString ifTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4567
                                cc == (eachCharToIgnore at:2) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4568
                                    runCol > 1 ifTrue:[
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4569
                                        (lineString at:(runCol-1)) == (eachCharToIgnore at:1) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4570
                                            skip := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4571
                                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4572
                                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4573
                                ] ifFalse:[
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4574
                                    cc == (eachCharToIgnore at:1) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4575
                                        runCol < lineString size ifTrue:[
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4576
                                            (lineString at:(runCol+1)) == (eachCharToIgnore at:2) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4577
                                                skip := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4578
                                            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4579
                                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4580
                                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4581
                                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4582
                            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4583
                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4584
                    ]
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4585
                ]].
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4586
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4587
                (inLineComment not & ign) ifTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4588
                    "/ íf in a line comment, single ' and " may occur.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4589
                    "/ ignoring means, that we ignore non-matching peers.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4590
                    ignoring ifTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4591
                        nesting pop first ~= cc ifTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4592
                            ^ failBlock value.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4593
                        ].
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4594
                        ignoring := false.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4595
                    ] ifFalse:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4596
                        nesting push:{cc . line}.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4597
                        ignoring := true.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4598
                    ].
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4599
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4600
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4601
                (ignoring | skip | inLineComment) ifFalse:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4602
                    ((idx := incSet indexOf:cc) ~~0) ifTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4603
                        nesting push:{(decSet at:idx). line}.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4604
                    ] ifFalse:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4605
                        (decSet includes:cc) ifTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4606
                            nesting pop first ~= cc ifTrue:[
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4607
                                ^ failBlock value.
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4608
                            ].
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4609
                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4610
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4611
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4612
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4613
                nesting isEmpty ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4614
                    skip ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4615
                        ^ foundBlock value:line value:runCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4616
                    ]
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4617
                ].
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4618
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4619
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4620
        line := line + delta.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4621
        (line < 1 or:[line > maxLine]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4622
            ^ failBlock value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4623
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4624
        lineString := list at:line.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4625
        direction == #fwd ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4626
            col := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4627
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4628
            col := lineString size
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4629
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4630
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4631
    ^ notFoundBlock value
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4632
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4633
    "Modified: / 15-10-1996 / 12:22:30 / cg"
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4634
    "Modified (comment): / 13-02-2017 / 20:32:43 / cg"
6456
c01624d73342 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6454
diff changeset
  4635
    "Modified (format): / 18-10-2018 / 18:42:55 / Stefan Vogel"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4636
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4637
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4638
searchFwd
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4639
    "search forward for the same pattern or selection again"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4640
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4641
    |ign match variable|
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  4642
2811
3a7aed97fd76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  4643
    searchAction notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4644
        "/ autosearch is cleared whenever there is search with user selection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4645
        (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
4177
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4646
    ].
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4647
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4648
    searchAction notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4649
        "/ confusing: this is for autosearch of variables (browse variable uses, for example)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4650
        self searchUsingSearchAction:#forward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4651
        ^ self.
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4652
    ].
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  4653
    searchBarActionBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4654
        searchBarActionBlock value:#forward value:self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4655
        ^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4656
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4657
    lastSearchWasVariableSearch ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4658
        variable := self syntaxElementForSelectedVariable.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4659
        variable notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4660
            self searchVariableWithSyntaxElement:variable forward:true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4661
            ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4662
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4663
        lastSearchWasVariableSearch := false.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4664
    ].
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4665
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4666
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4667
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  4668
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4669
    selectStyle == #wordLeft ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4670
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4671
         remove the space from the selection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4672
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4673
        selectionStartCol := selectionStartCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4674
        super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4675
        selectStyle := #word.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4676
        self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4677
    ].
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4678
    self setSearchPatternWithMatchEscapes: match.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4679
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4680
    lastSearchPattern isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4681
        LastSearchPatterns size > 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4682
            lastSearchPattern := LastSearchPatterns first
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4683
        ]
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4684
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4685
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4686
    lastSearchPattern notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4687
        self rememberSearchPattern:lastSearchPattern.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4688
        lastSearchDirection := #forward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4689
        self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4690
            searchFwd:lastSearchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4691
            ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4692
            match: match
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4693
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4694
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4695
    "Modified: / 08-03-2012 / 14:25:42 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4696
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4697
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4698
searchFwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4699
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4700
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4701
    self searchFwd:pattern ifAbsent:[self showNotFound].
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4702
"/    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4703
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4704
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4705
    "Modified: / 21-09-2006 / 16:52:04 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4706
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4707
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4708
searchFwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4709
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4710
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4711
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4712
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4713
                                pattern:pattern)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4714
        ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4715
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4716
    "Modified: / 21-09-2006 / 16:51:28 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4717
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4718
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4719
searchFwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4720
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4721
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4722
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4723
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4724
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4725
                                ignoreCase:ign)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4726
        ifAbsent:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4727
                    self sensor compressKeyPressEventsWithKey:#FindNext.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4728
                    self showNotFound
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4729
                 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4730
    "/ lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4731
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4732
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4733
    "Created: / 13-09-1997 / 06:18:13 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4734
    "Modified: / 23-03-2012 / 12:09:59 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4735
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4736
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4737
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4738
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4739
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4740
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4741
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4742
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4743
                                ignoreCase:ign)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4744
        ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4745
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4746
    "Modified: 13.9.1997 / 01:05:35 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4747
    "Created: 13.9.1997 / 06:18:27 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4748
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4749
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4750
searchFwd:pattern ignoreCase:ign match: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4751
    "do a forward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4752
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4753
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4754
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4755
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4756
                                ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4757
                                match:match)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4758
        ifAbsent:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4759
                    self sensor compressKeyPressEventsWithKey:#FindNext.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4760
                    self showNotFound
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4761
                 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4762
    "/ lastSearchIgnoredCase := ign.
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4763
    "/ lastSearchWasMatch := match.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4764
    lastSearchPattern := pattern string
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4765
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4766
    "Created: / 13-09-1997 / 06:18:13 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4767
    "Modified: / 23-03-2012 / 12:12:47 / cg"
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4768
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4769
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4770
searchFwd:pattern ignoreCase:ign match: match ifAbsent:aBlock
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4771
    "do a forward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4772
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4773
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4774
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4775
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4776
                                ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4777
                                match:match)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4778
        ifAbsent:aBlock
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4779
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4780
    "Modified: 13.9.1997 / 01:05:35 / cg"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4781
    "Created: 13.9.1997 / 06:18:27 / cg"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4782
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4783
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4784
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4785
    "do a forward search"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4786
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4787
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4788
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4789
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4790
                                ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4791
                                match:match)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4792
        startingAtLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4793
        ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4794
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4795
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4796
searchFwdUsingSpec:searchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4797
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4798
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4799
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4800
        searchFwdUsingSpec:searchSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4801
        ifAbsent:[self showNotFound].
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4802
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4803
"/    lastSearchIgnoredCase := false.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4804
    lastSearchPattern := searchSpec pattern string
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4805
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4806
    "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
  4807
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4808
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4809
searchFwdUsingSpec:searchSpec ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4810
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4811
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4812
    |pos startLine startCol|
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4813
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4814
    pos := self startPositionForSearchForward.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4815
    startLine := pos y.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4816
    startCol := pos x.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4817
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4818
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4819
        searchFwdUsingSpec:searchSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4820
        startingAtLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4821
        ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4822
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4823
    "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
  4824
    "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
  4825
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4826
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4827
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
  4828
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4829
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4830
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4831
        searchForwardUsingSpec:searchSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4832
        startingAtLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4833
        ifFound:[:line :col :endColOrNil|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4834
            self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4835
        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4836
        ifAbsent:aBlock
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4837
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4838
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4839
searchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4840
    "return the last search pattern"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4841
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4842
    ^ lastSearchPattern
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4843
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4844
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4845
searchUsingSearchAction:direction
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4846
    "search using a searchaction which has been given by someone else.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4847
     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
  4848
      a language aware search (as opposed to a naive string search)"
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4849
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4850
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4851
        searchUsingSearchAction:direction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4852
        ifAbsent:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4853
                    self sensor compressKeyPressEventsWithKey:#FindNext.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4854
                    self showNotFound
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4855
                 ]
2816
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4856
!
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4857
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4858
searchUsingSearchAction:direction ifAbsent:notFoundAction
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4859
    "search using a searchaction which has been given by someone else.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4860
     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
  4861
      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
  4862
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4863
    |pos startLine startCol|
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4864
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4865
    pos :=  direction == #backward
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4866
                ifTrue:[self startPositionForSearchBackward]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4867
                ifFalse:[self startPositionForSearchForward].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4868
    startLine := pos y.
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4869
    startCol := pos x.
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4870
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4871
    searchAction notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4872
        searchAction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4873
            value:direction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4874
            value:startLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4875
            value:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4876
            value:[:line :col | self selectFromLine:line toLine:line]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4877
            value:notFoundAction.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4878
        self hasSelection ifTrue: [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4879
            self changeTypeOfSelectionTo: #searchAction.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4880
        ].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4881
    ].
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4882
!
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4883
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4884
setSearchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4885
    "set the searchpattern from the selection if there is one"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4886
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4887
    self setSearchPatternWithMatchEscapes: false.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4888
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4889
3904
dd4c2dace4f5 changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents: 3892
diff changeset
  4890
setSearchPattern:aStringOrNil
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4891
    "set the searchpattern for future searches"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4892
3904
dd4c2dace4f5 changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents: 3892
diff changeset
  4893
    aStringOrNil isEmptyOrNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4894
        lastSearchPattern := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4895
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4896
        "/ not withoutSeparators: may want to search for spaces...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4897
        lastSearchPattern := aStringOrNil asString "withoutSeparators" string.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4898
    ].
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4899
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4900
    "Modified: / 6.3.1999 / 23:47:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4901
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4902
2200
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4903
setSearchPattern:aString ignoreCase:aBoolean
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4904
    "set the searchpattern and caseIgnore for future searches"
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4905
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4906
    self setSearchPattern:aString.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4907
    lastSearchIgnoredCase := aBoolean.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4908
!
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4909
5713
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4910
setSearchPattern:aString ignoreCase:ignoreCaseBoolean match:matchBoolean
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4911
    "set the searchpattern and caseIgnore for future searches"
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4912
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4913
    self setSearchPattern:aString.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4914
    lastSearchIgnoredCase := ignoreCaseBoolean.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4915
    lastSearchWasMatch := matchBoolean.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4916
!
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4917
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4918
setSearchPatternWithMatchEscapes: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4919
    "set the searchpattern from the selection if there is one"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4920
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4921
    |sel searchPattern |
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4922
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4923
"/    clickPos isNil ifTrue:[^ self].
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4924
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4925
    sel := self selection.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4926
    sel notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4927
        searchPattern := sel asString.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4928
        match ifTrue:[searchPattern := searchPattern withMatchEscapes].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4929
        self setSearchPattern:searchPattern.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4930
    ]
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4931
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4932
    "Modified: / 6.3.1999 / 23:48:04 / cg"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4933
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4934
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4935
showMatch:pattern atLine:line col:col
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4936
    <resource: #obsolete>
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4937
    "after a search, highlight the matched pattern.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4938
     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
  4939
     (for now, it only highlights simple patterns and '*string*' correctly)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4940
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4941
    self showMatch:pattern isMatch:true atLine:line col:col endCol:nil
4120
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4942
!
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4943
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4944
showMatch:pattern isMatch:isMatch atLine:line col:col
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4945
    <resource: #obsolete>
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4946
    "after a search, highlight the matched pattern."
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4947
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4948
    self showMatch:pattern isMatch:isMatch atLine:line col:col endCol:nil
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4949
!
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4950
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4951
showMatch:pattern isMatch:isMatch atLine:line col:col endCol:encColOrNil
4120
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4952
    "after a search, highlight the matched pattern.
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4953
     The code below needs a rewrite to take care of match-characters
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4954
     (for now, it only highlights simple patterns and '*string*' correctly)"
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4955
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4956
    |endCol realPattern|
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4957
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4958
    (endCol := encColOrNil) isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4959
        "/ a hack.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4960
        realPattern := pattern.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4961
        isMatch ifTrue: [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4962
            (realPattern startsWith:$*) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4963
                realPattern := realPattern copyButFirst
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4964
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4965
            (realPattern endsWith:$*) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4966
                realPattern := realPattern copyButLast
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4967
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4968
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4969
        endCol := (col + realPattern size - 1).
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
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4972
    self selectFromLine:line col:col toLine:line col:endCol.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4973
    self makeLineVisible:line
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
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4976
startPositionForSearchBackward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4977
    ^ self startPositionForSearchBackwardBasedOnSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4978
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4979
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4980
startPositionForSearchBackwardBasedOnSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4981
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4982
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4983
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4984
        startLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4985
        startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4986
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4987
        startLine := 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4988
        startCol := 1
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4989
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4990
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4991
    ^ startCol @ startLine
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4992
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4993
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4994
startPositionForSearchForward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4995
    ^ self startPositionForSearchForwardBasedOnSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4996
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4997
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4998
startPositionForSearchForwardBasedOnSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4999
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  5000
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  5001
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5002
        startLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5003
        startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  5004
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5005
        startLine := 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5006
        startCol := 1
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  5007
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  5008
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  5009
    ^ startCol @ startLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5010
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5011
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5012
!TextView methodsFor:'selections'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5013
2604
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  5014
changeTypeOfSelectionTo:newType
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  5015
    "ignored here - but redefined in subclasses which
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  5016
     differentiate between pasted- and user-selections"
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  5017
!
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  5018
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5019
expandSelectionDown
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5020
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5021
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5022
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5023
        expandingTop == true ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5024
            l := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5025
            selectionStartLine := selectionStartLine + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5026
            (selectionStartLine > clickLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5027
            or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5028
            ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5029
                t := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5030
                selectionStartLine := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5031
                selectionEndLine := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5032
                t := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5033
                selectionStartCol := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5034
                selectionEndCol := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5035
                expandingTop := false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5036
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5037
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5038
            l := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5039
            selectionEndLine := selectionEndLine + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5040
        ].
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  5041
"/        self redrawLine:l.
2442
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  5042
"/        self redrawLine:l+1.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5043
        self validateNewSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5044
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5045
        self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5046
        self redrawFromLine:l to:l+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5047
        self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5048
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5049
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5050
    "Created: / 01-03-1996 / 23:35:08 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5051
    "Modified: / 18-03-1996 / 17:18:15 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5052
    "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
  5053
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5054
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5055
expandSelectionLeft
502
6f3d0d7a782c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  5056
    |c l t c1 c2|
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5057
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5058
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5059
        expandingTop == true ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5060
            selectionStartCol == 0 ifTrue:[^ self].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5061
            l := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5062
            selectionStartCol := (selectionStartCol - 1) max:1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5063
            c := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5064
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5065
            l := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5066
            selectionEndCol := (selectionEndCol - 1) max:0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5067
            c := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5068
            selectionEndLine == selectionStartLine ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5069
                selectionEndCol <= selectionStartCol ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5070
                    t := selectionStartCol. selectionStartCol := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5071
                    selectionEndCol := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5072
                    expandingTop := true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5073
                    c := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5074
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5075
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5076
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5077
        c1 := c.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5078
        c2 := c1 + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5079
        c1 == 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5080
            c1 := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5081
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5082
        self validateNewSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5083
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5084
        self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5085
        self redrawLine:l from:c1 to:c2.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5086
        self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5087
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5088
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5089
    "Modified: / 18-03-1996 / 17:05:46 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5090
    "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
  5091
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5092
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5093
expandSelectionRight
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5094
    |l c t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5095
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5096
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5097
        expandingTop == true ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5098
            l := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5099
            c := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5100
            selectionStartCol := selectionStartCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5101
            l == selectionEndLine ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5102
                c >= selectionEndCol ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5103
                    expandingTop := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5104
                    t := selectionStartCol. selectionStartCol := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5105
                    selectionEndCol := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5106
                    c := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5107
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5108
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5109
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5110
            l := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5111
            c := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5112
            selectionEndCol := selectionEndCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5113
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5114
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5115
        self validateNewSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5116
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5117
        self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5118
        self redrawLine:l from:(c max:1) to:c+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5119
        self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5120
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5121
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5122
    "Created: / 01-03-1996 / 23:33:17 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5123
    "Modified: / 06-03-1996 / 13:54:10 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5124
    "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
  5125
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5126
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5127
expandSelectionUp
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5128
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5129
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5130
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5131
        expandingTop == true ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5132
            selectionStartLine := (selectionStartLine - 1) max:1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5133
            l := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5134
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5135
            selectionEndLine := (selectionEndLine - 1) max:0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5136
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5137
            l := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5138
            (selectionEndLine < clickLine
6454
64f4dc5b8c5a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6428
diff changeset
  5139
                or:[(selectionEndLine == clickLine 
64f4dc5b8c5a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6428
diff changeset
  5140
                    and:[clickCol notNil
64f4dc5b8c5a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6428
diff changeset
  5141
                    and:[selectionEndCol < clickCol]])]
64f4dc5b8c5a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6428
diff changeset
  5142
            ) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5143
                t := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5144
                selectionStartLine := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5145
                selectionEndLine := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5146
                t := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5147
                selectionStartCol := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5148
                selectionEndCol := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5149
                l := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5150
                expandingTop := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5151
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5152
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5153
        self validateNewSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5154
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5155
        self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5156
        "/ self redrawLine:l.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5157
        "/ self redrawLine:l+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5158
        self redrawFromLine:l to:l+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5159
        self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5160
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5161
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5162
    "Modified: / 06-03-1996 / 14:12:06 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5163
    "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
  5164
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  5165
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5166
hasSelection
6261
4cf20b175ac9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6256
diff changeset
  5167
    "return true, if there is a text selection"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5168
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5169
    ^ selectionStartLine notNil
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5170
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5171
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  5172
hasSelectionForCopy
6282
bd0d311af082 #OTHER by mawalch
mawalch
parents: 6269
diff changeset
  5173
    "return true, if there is a selection which can be copied
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  5174
     (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
  5175
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  5176
    ^ self hasSelection
6282
bd0d311af082 #OTHER by mawalch
mawalch
parents: 6269
diff changeset
  5177
bd0d311af082 #OTHER by mawalch
mawalch
parents: 6269
diff changeset
  5178
    "Modified (comment): / 29-01-2018 / 14:42:52 / mawalch"
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  5179
!
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  5180
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  5181
hasSelectionWithinSingleLine
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  5182
    "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
  5183
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  5184
    ^ selectionStartLine notNil
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  5185
      and:[ selectionStartLine == selectionEndLine ]
3315
1b42d2f8dcbc CRLF management
fm
parents: 3308
diff changeset
  5186
1b42d2f8dcbc CRLF management
fm
parents: 3308
diff changeset
  5187
    "Modified: / 04-07-2006 / 18:42:59 / fm"
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  5188
!
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  5189
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  5190
hasSingleFullLineSelected
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5191
    ^ (selectionStartLine notNil
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  5192
      and:[selectionEndLine notNil
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  5193
      and:[selectionEndLine == (selectionStartLine+1)
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  5194
      and:[selectionStartCol == 1
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  5195
      and:[selectionEndCol == 0
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  5196
    ]]]])
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  5197
!
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  5198
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  5199
isInSelection:line col:aColNr
96256221e3af support drag
ca
parents: 2581
diff changeset
  5200
    "returns true, if the line, and column is in the selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  5201
    "
3438
d83030fd5005 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3426
diff changeset
  5202
    selectionStartLine isNil ifTrue:[^ false].
d83030fd5005 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3426
diff changeset
  5203
    selectionEndLine   isNil ifTrue:[^ false].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  5204
96256221e3af support drag
ca
parents: 2581
diff changeset
  5205
    (line between:selectionStartLine and:selectionEndLine) ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5206
        ^ false
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  5207
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  5208
96256221e3af support drag
ca
parents: 2581
diff changeset
  5209
    line == selectionStartLine ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5210
        aColNr < selectionStartCol ifTrue:[^ false]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  5211
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  5212
96256221e3af support drag
ca
parents: 2581
diff changeset
  5213
    line == selectionEndLine ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5214
        (selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  5215
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  5216
    ^ true
96256221e3af support drag
ca
parents: 2581
diff changeset
  5217
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  5218
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5219
makeSelectionVisible
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5220
    "scroll to make the selection visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5221
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5222
    |line col|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5223
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5224
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5225
        expandingTop == true ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5226
            line := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5227
            col := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5228
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5229
            line := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5230
            col := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5231
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5232
        self makeLineVisible:line.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5233
        self makeColVisible:col inLine:line.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5234
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5235
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5236
    "Modified: 6.3.1996 / 13:53:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5237
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5238
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5239
selectAll
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5240
    "select the whole text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5241
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5242
    self selectFromLine:1 col:1 toLine:(list size + 1) col:0
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5243
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5244
4140
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5245
selectFromCharacterPosition:pos1
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5246
    "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
  5247
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5248
    |line1 col1 line2 col2|
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5249
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5250
    line1 := self lineOfCharacterPosition:pos1.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5251
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5252
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5253
    line2 := (list size + 1).
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5254
    col2 := 0.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5255
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5256
!
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5257
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5258
selectFromCharacterPosition:pos1 to:pos2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5259
    "compute line/col from character positions and select the text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5260
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5261
    |line1 col1 line2 col2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5262
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  5263
    pos1 > pos2 ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5264
        ^ self unselect
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  5265
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5266
    line1 := self lineOfCharacterPosition:pos1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5267
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  5268
    col1 < 1 ifTrue:[ col1 := 1 ].
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  5269
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5270
    line2 := self lineOfCharacterPosition:pos2.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5271
    col2 := pos2 - (self characterPositionOfLine:line2 col:1) + 1.
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  5272
    col2 < 1 ifTrue:[ col2 := 1 ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5273
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5274
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5275
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5276
selectFromLine:startLine col:startCol toLine:endLine col:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5277
    "select a piece of text and redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5278
5046
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  5279
    ((selectionStartLine = startLine)
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  5280
      and:[ (selectionStartCol = startCol)
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  5281
      and:[ (selectionEndLine = endLine)
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  5282
      and:[ (selectionEndCol = endCol) ]]]) ifTrue:[^ self ].
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  5283
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5284
    self unselect.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5285
    startLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5286
        "new:"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5287
        endLine < startLine ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5288
            ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5289
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5290
        (endLine == startLine and:[endCol < startCol]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5291
            endCol ~~ 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5292
                self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5293
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5294
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5295
        ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5296
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5297
" old:
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5298
        endLine < startLine ifTrue:[^ self].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5299
        (startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5300
"
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5301
        selectionStartLine := startLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5302
        selectionStartCol := startCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5303
        selectionEndLine := endLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5304
        selectionEndCol := endCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5305
        self validateNewSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5306
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5307
        self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5308
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5309
        (selectionStartLine == selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5310
            self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5311
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5312
            selectionStartLine to:selectionEndLine do:[:lineNr |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5313
                self redrawLine:lineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5314
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5315
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5316
        selectStyle := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5317
    ]
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5318
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5319
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5320
     |v|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5321
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5322
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5323
     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
  5324
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5325
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5326
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5327
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5328
     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
  5329
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5330
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5331
    "Modified: / 02-01-1997 / 13:32:25 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5332
    "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
  5333
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5334
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5335
selectFromLine:startLine toLine:endLine
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5336
    "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
  5337
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5338
    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
  5339
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5340
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5341
     |v|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5342
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5343
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5344
     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
  5345
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5346
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5347
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5348
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5349
     v selectFromLine:2 toLine:10
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5350
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5351
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5352
    "Modified: 29.4.1996 / 12:23:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5353
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5354
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5355
selectLine:selectLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5356
    "select one line and redraw it"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5357
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5358
    self selectFromLine:selectLine col:1 toLine:(selectLine + 1) col:0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5359
    wordStartCol := selectionStartCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5360
    wordEndCol := selectionEndCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5361
    wordStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5362
    wordEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5363
    selectStyle := #line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5364
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5365
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5366
selectLineAtY:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5367
    "select the line at given y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5368
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  5369
    |selectLine|
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  5370
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  5371
    selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5372
    selectLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5373
        self selectLine:selectLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5374
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5375
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5376
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5377
selectLineWhereCharacterPosition:pos
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5378
    "select the line, where characterPosition pos is living.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5379
     The argument pos starts at 1 from the start of the text
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  5380
     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
  5381
     character position within a string to line-position in view)."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5382
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5383
    self selectLine:(self lineOfCharacterPosition:pos)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5384
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5385
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5386
selectWordAtLine:line col:col
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5387
    "select the word at given line/col"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5388
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  5389
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5390
        wordAtLine:line col:col do:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5391
            :beginLine :beginCol :endLine :endCol :style |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5392
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5393
            self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5394
            selectStyle := style
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5395
        ]
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5396
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5397
    "Modified: 18.3.1996 / 17:30:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5398
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5399
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5400
selectWordAtX:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5401
    "select the word at given x/y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5402
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5403
    |selectVisibleLine selectLine selectCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5404
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5405
    selectStyle := nil.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5406
    selectVisibleLine := self visibleLineOfY:y.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5407
    selectLine := self visibleLineToListLine:selectVisibleLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5408
    selectLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5409
        selectCol := self colOfX:x inVisibleLine:selectVisibleLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5410
        self selectWordAtLine:selectLine col:selectCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5411
    ]
1661
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5412
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5413
    "Modified: / 8.9.1998 / 21:22:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5414
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5415
3528
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5416
selectedInterval
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5417
    "return the selection-boundaries as interval"
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5418
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5419
    ^ self selectionStartIndex to:(self selectionStopIndex - 1)
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5420
!
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5421
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5422
selection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5423
    "return the selection as a collection of (line-)strings.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5424
     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
  5425
     collection will be an empty string."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5426
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5427
    |sel|
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5428
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5429
    selectionStartLine isNil ifTrue:[^ nil].
4466
5c7a01426564 changed: #selection
Claus Gittinger <cg@exept.de>
parents: 4462
diff changeset
  5430
    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
  5431
    sel notEmptyOrNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5432
        "/ this is rubbish; we are now always using unicode internally
6269
49be8ecf8afa #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  5433
        "/ and many more conversions would be needed at many places...
49be8ecf8afa #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  5434
        gc characterEncoding ~~ #'iso10646-1' ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5435
            sel := sel encodeFrom:gc characterEncoding into:#'iso10646-1'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5436
        ].
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5437
    ].
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5438
    ^ sel
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
  5439
4361
646cd7c5513e comment/format in: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents: 4321
diff changeset
  5440
    "Modified (comment): / 25-01-2012 / 00:29:09 / cg"
6269
49be8ecf8afa #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  5441
    "Modified: / 19-01-2018 / 12:22:31 / stefan"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5442
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5443
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5444
selectionAsString
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5445
    "return the selection as a String (i.e. without emphasis)"
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5446
2693
9e7da8ff444d unused methodLocals removed
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
  5447
    |sel|
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5448
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5449
    (sel := self selection) isNil ifTrue:[^ nil].
2419
2ae3350454bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  5450
    sel := sel collect:[:each| each isNil ifTrue:[nil] ifFalse:[each string]].
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5451
    ^ (sel asStringWithCRsFrom:1 to:(sel size) compressTabs:false withCR:false) string
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5452
!
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5453
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5454
selectionChanged
5658
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5455
    "can be redefined for notification or special actions.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5456
     If you do, do not forget to do a super selectionChanged"
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5457
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5458
    self changed:#selection.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5459
"/    self selectionHolder value:{ selectionStartCol @ selectionStartLine .
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5460
"/                                 selectionEndCol @ selectionEndLine }
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5461
!
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5462
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5463
selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5464
    ^ selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5465
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5466
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5467
selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5468
    ^ selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5469
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5470
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5471
selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5472
    ^ selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5473
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5474
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5475
selectionStartLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5476
    ^ selectionStartLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5477
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5478
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5479
setPrimarySelection
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5480
    "can be redefined for notification or special actions"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5481
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5482
    device notNil ifTrue:[
6312
5c43cfe6809c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6294
diff changeset
  5483
        "On X11, be nice and set the PRIMARY selection;
5c43cfe6809c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6294
diff changeset
  5484
         this can be pasted with the middle button into an xpterm.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5485
         (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
6312
5c43cfe6809c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6294
diff changeset
  5486
        device setPrimaryText:(self selectionAsString) ownerView: self.
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5487
    ].
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5488
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5489
    "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
  5490
!
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5491
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5492
st80SelectMode
3459
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5493
    st80SelectMode notNil ifTrue:[^ st80SelectMode].
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5494
    ^ self class st80SelectMode
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5495
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5496
    "Created: / 03-07-2006 / 16:30:59 / cg"
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5497
!
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5498
3459
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5499
st80SelectMode:aBoolean
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5500
    st80SelectMode := aBoolean
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5501
!
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5502
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5503
unselect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5504
    "unselect - if there was a selection redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5505
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5506
    |startLine endLine startVisLine endVisLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5507
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5508
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5509
        startLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5510
        endLine := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5511
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5512
        self unselectWithoutRedraw.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5513
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5514
        "/ if the selection is not visible, we are done
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5515
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5516
        startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5517
        endLine < firstLineShown ifTrue:[^ self].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5518
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5519
        startLine < firstLineShown ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5520
            startVisLine := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5521
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5522
            startVisLine := self listLineToVisibleLine:startLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5523
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5524
        endLine >= (firstLineShown + nLinesShown) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5525
            endVisLine := nLinesShown
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5526
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5527
            endVisLine := self listLineToVisibleLine:endLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5528
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5529
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  5530
        "/ if it's only part of a line, just redraw what has to be
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5531
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5532
        (startLine == endLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5533
            super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5534
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5535
            self redrawFromVisibleLine:startVisLine to:endVisLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5536
        ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5537
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5538
    selectStyle := nil
503
468d4a36ed67 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
  5539
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  5540
    "Modified: / 29-05-1996 / 14:54:11 / cg"
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  5541
    "Modified (comment): / 13-02-2017 / 20:32:49 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5542
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5543
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5544
unselectWithoutRedraw
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5545
    "forget selection but do not redraw the selection area
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5546
     - 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
  5547
     known to be invisible (however, redraw knows about that anyway)."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5548
2735
5ba2010aefa4 *** empty log message ***
penk
parents: 2730
diff changeset
  5549
    selectionStartLine := selectionEndLine := nil.
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5550
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5551
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5552
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5553
validateNewSelection
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5554
     "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
  5555
      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
  5556
      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
  5557
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5558
    ^ self
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5559
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5560
    "Modified: 29.4.1996 / 12:32:08 / cg"
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5561
!
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5562
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5563
withSelectionForeground:hilightFg background:hilightBg do:aBlock
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5564
    "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
  5565
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5566
    |oldFg oldBg|
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5567
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5568
    "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5569
     change color of selection & hide cursor
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5570
    "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5571
    oldFg := selectionFgColor.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5572
    oldBg := selectionBgColor.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5573
    selectionBgColor := hilightBg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5574
    selectionFgColor := hilightFg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5575
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5576
    expandingTop := true.       "/ hack to make the top of the selection visible
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5577
    self makeSelectionVisible.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5578
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5579
        selectionEndLine notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5580
            self redrawFromLine:selectionStartLine to:selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5581
        ].
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5582
    ].
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5583
    self flush.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5584
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5585
    aBlock ensure:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5586
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5587
         undo selection color change and show cursor again
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5588
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5589
        selectionFgColor := oldFg.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5590
        selectionBgColor := oldBg.
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5591
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5592
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5593
4310
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5594
!TextView methodsFor:'testing'!
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5595
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5596
isTextView
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5597
    "I am showing text"
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5598
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5599
    ^ true
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5600
! !
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5601
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  5602
!TextView class methodsFor:'documentation'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5603
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5604
version
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  5605
    ^ '$Header$'
3964
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5606
!
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5607
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5608
version_CVS
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  5609
    ^ '$Header$'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5610
! !
2630
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
  5611
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  5612
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  5613
TextView initialize!