TextView.st
author Claus Gittinger <cg@exept.de>
Thu, 09 Nov 2017 20:09:30 +0100
changeset 6225 0122e4e6c587
parent 6206 f7a386aee648
child 6256 76350fb3380f
permissions -rw-r--r--
#FEATURE by cg class: GenericToolbarIconLibrary class added: #hideFilter16x16Icon
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'
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    26
	classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    27
		DefaultSelectionBackgroundColor
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    28
		DefaultAlternativeSelectionForegroundColor
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    29
		DefaultAlternativeSelectionBackgroundColor MatchDelayTime
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    30
		WordSelectCatchesBlanks LastSearchPatterns
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    31
		NumRememberedSearchPatterns LastSearchIgnoredCase
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    32
		LastSearchWasMatch DefaultParenthesisSpecification
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    33
		LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    34
		LastSearchWasReplace LastSearchReplacedString'
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    35
	poolDictionaries:''
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
    36
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    37
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    38
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
    39
!TextView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    40
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    41
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    42
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    43
 COPYRIGHT (c) 1989 by Claus Gittinger
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    44
              All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    45
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    46
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    47
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    48
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    49
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    50
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    51
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    52
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    53
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    54
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
    55
documentation
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    56
"
120
claus
parents: 119
diff changeset
    57
    a view for readOnly text - this class adds selections to a simple list.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    58
    The text is not editable and there is no cursor.
120
claus
parents: 119
diff changeset
    59
    Use TextViews for readonly text, EditTextView for editable text.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    60
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    61
    Please read the historic notice in the ListView class.
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    62
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
    63
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    64
120
claus
parents: 119
diff changeset
    65
      selectionStartLine      <Number>                the line of the selection start (or nil)
claus
parents: 119
diff changeset
    66
      selectionStartCol       <Number>                the col of the selection start
claus
parents: 119
diff changeset
    67
      selectionEndLine        <Number>                the line of the selection end
claus
parents: 119
diff changeset
    68
      selectionEndCol         <Number>                the col of the selection end
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    69
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    70
      clickStartLine          <Number>                temporary - remember where select operation started
120
claus
parents: 119
diff changeset
    71
      clickStartCol           <Number>                temporary
claus
parents: 119
diff changeset
    72
      clickLine               <Number>                temporary
claus
parents: 119
diff changeset
    73
      clickCol                <Number>                temporary
claus
parents: 119
diff changeset
    74
      clickCount              <Number>                temporary
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    75
      expandingTop            <Boolean>               temporary - for expandSelection
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    76
120
claus
parents: 119
diff changeset
    77
      selectionFgColor        <Color>                 color used to draw selections
claus
parents: 119
diff changeset
    78
      selectionBgColor        <Color>                 color used to draw selections
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    79
120
claus
parents: 119
diff changeset
    80
      selectStyle             <Symbol>                how words are selected
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    81
120
claus
parents: 119
diff changeset
    82
      directoryForFileDialog  <nil|pathName>          directory where save dialog should start
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    83
120
claus
parents: 119
diff changeset
    84
      contentsWasSaved        <Boolean>               set to true, whenever saved in a file
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
    85
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
    86
      externalEncoding        <Symbol|nil>            external encoding, used when text is saved to
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    87
                                                      a file. Usually something like
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    88
                                                      #jis7, #euc, #sjis etc.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    89
                                                      (currently only passed down from the
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    90
                                                       fileBrowser)
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
    91
96256221e3af support drag
ca
parents: 2581
diff changeset
    92
      dropSource              <DropSource>            drag operation descriptor or nil (dragging disabled)
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    93
      dragIsActive            <Boolean>               true, drag operation is activated
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    94
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
    95
      searchAction            <Block>                 an autosearch action; typically set by the browser.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    96
                                                      Will be used as default when searchFwd/searchBwd is
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    97
                                                      pressed. If the searchPattern is changed, no autosearch
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
    98
                                                      action will be executed.
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
    99
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
   100
      searchBarActionBlock    <Block>                 search action block for embedded search
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   101
                                                      panel. Used as second chance for searchFwd/bwd
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   102
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   103
    [class variables:]
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   104
        ST80Selections        <Boolean>               enables ST80 style doubleclick behavior
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   105
                                                      (right after opening parenthesis, right before
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   106
                                                       closing parenthesis, at begin of a line
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   107
                                                       at begin of text)
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   108
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   109
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   110
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   111
      textView.background                       defaults to viewBackground
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   112
      textView.ViewFont                         defaults to textFont
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   113
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   114
      text.st80Selections                       st80 behavior (click on char after parent or quote)
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   115
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   116
      text.selectionForegroundColor             defaults to textBackgroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   117
      text.selectionBackgroundColor             defaults to textForegroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   118
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   119
      text.alternativeSelectionForegroundColor  pasted text (i.e. paste will not replace)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   120
                                                defaults to selectionForegroundColor
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   121
      text.alternativeSelectionBackgroundColor  pasted text (i.e. paste will not replace)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   122
                                                defaults to selectionBackgroundColor
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   123
    [author:]
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   124
        Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   125
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   126
    [see also:]
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   127
        EditTextView CodeView Workspace
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   128
"
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   129
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   130
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   131
examples
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   132
"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   133
    although textViews (and instances of subclasses) are mostly used
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   134
    as components (in the fileBrowser, the browser, the launcher etc.),
5842
78747ab7d231 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5841
diff changeset
   135
    they may also be opened as a textEditor. Notice, that usually,
78747ab7d231 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5841
diff changeset
   136
    instances of one of my subclasses (EditTextView, TextCollector, Workspace)
78747ab7d231 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5841
diff changeset
   137
    are actually used.
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   138
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   139
    open a (readonly) textView on some information text:
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   140
                                                        [exBegin]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   141
        TextView
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   142
            openWith:'read this
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   143
and that,
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   144
and also this'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   145
            title:'demonstration'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   146
                                                        [exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   147
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   148
    the same, but open it modal:
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   149
                                                        [exBegin]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   150
        TextView
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   151
            openModalWith:'read this first'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   152
            title:'demonstration'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   153
                                                        [exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   154
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   155
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   156
    open it modal (but editable) on some text:
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   157
    (must accept before closing)
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   158
    This is somewhat kludgy - when closed, the view has already
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   159
    nilled its link to the model. Therefore, the accept must be
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   160
    done 'manually' below.
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   161
    However, usually an applicationModel is installed as the
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   162
    editor-topViews application. This would get a closeRequest,
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   163
    where it could handle things.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   164
                                                        [exBegin]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   165
        |m textView|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   166
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   167
        m := 'read this first' asValue.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   168
        textView := EditTextView openModalOnModel:m.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   169
        textView modified ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   170
            (self confirm:'text was not accepted - do it now ?')
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   171
            ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   172
                m value:textView contents
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
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   176
        Transcript showCR:m value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   177
                                                        [exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   178
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   179
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   180
    open a textEditor on some file:
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   181
                                                        [exBegin]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   182
        EditTextView openOn:'Makefile'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   183
                                                        [exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   184
5841
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   185
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   186
    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
   187
    (to avoid reading all lines, when usig a virtualArray)
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   188
                                                        [exBegin]
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   189
        |a m|
5845
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   190
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   191
        a := VirtualArray new
5841
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   192
                setSize:100000000;
5845
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   193
                generator:[:lNr | Transcript show:'called for '; showCR:lNr.
5841
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   194
                                  'this is line: ',lNr printString ].
5845
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   195
        m := a asValue.
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   196
        (ScrollableView forView:TextView new)
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   197
            expandTabsWhenUpdating:false;
5841
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   198
            checkLineEndConventionWhenUpdating:false;
5845
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   199
            model:m;
40de1cfd6e16 #OTHER by mawalch
mawalch
parents: 5842
diff changeset
   200
            open; inspect.
5841
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   201
                                                        [exEnd]
d3aa2a43a495 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5820
diff changeset
   202
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   203
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   204
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   205
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   206
!TextView class methodsFor:'instance creation'!
119
claus
parents: 97
diff changeset
   207
claus
parents: 97
diff changeset
   208
on:aModel aspect:aspect change:change menu:menu initialSelection:initial
claus
parents: 97
diff changeset
   209
    "for ST-80 compatibility"
claus
parents: 97
diff changeset
   210
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   211
    ^ (self new)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   212
        on:aModel
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   213
        aspect:aspect
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   214
        list:aspect
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   215
        change:change
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   216
        menu:menu
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   217
        initialSelection:initial
3280
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
703642244271 +with:someText (VW-compat.)
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
   220
with:someText
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   221
    ^ (self new)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   222
        contents:someText
119
claus
parents: 97
diff changeset
   223
! !
claus
parents: 97
diff changeset
   224
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   225
!TextView class methodsFor:'class initialization'!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   226
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   227
initialize
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   228
    DefaultParenthesisSpecification isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   229
        DefaultParenthesisSpecification := IdentityDictionary new.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   230
        DefaultParenthesisSpecification at:#open        put:#( $( $[ ${ "$> $<") .
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   231
        DefaultParenthesisSpecification at:#close       put:#( $) $] $} "$> $<").
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   232
        DefaultParenthesisSpecification at:#ignore      put:#( $' $" '$[' '$]' '${' '$)' ).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   233
        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
   234
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   235
! !
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   236
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   237
!TextView class methodsFor:'defaults'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
   238
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   239
defaultIcon
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   240
    "return the default icon if started as a topView"
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   241
3496
8c92a96c4e27 icon resource
Claus Gittinger <cg@exept.de>
parents: 3491
diff changeset
   242
    <resource: #programImage>
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   243
    <resource: #style (#ICON #ICON_FILE)>
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   244
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   245
    |nm i|
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   246
1146
027884518745 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   247
    i := self classResources at:'ICON' default:nil.
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   248
    i isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   249
        nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   250
        i := Smalltalk imageFromFileNamed:nm forClass:self.
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   251
    ].
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   252
    i notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   253
        i := i onDevice:Display
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   254
    ].
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   255
    ^ i
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   256
3496
8c92a96c4e27 icon resource
Claus Gittinger <cg@exept.de>
parents: 3491
diff changeset
   257
    "Modified: / 17-09-2007 / 11:36:29 / cg"
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   258
!
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   259
910
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   260
defaultMenuMessage
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   261
    "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
   262
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   263
    ^ #editMenu
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   264
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   265
    "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
   266
!
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   267
4254
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
    ^ DefaultParenthesisSpecification
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   270
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   271
    "Created: / 14-06-2011 / 14:00:59 / cg"
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   272
!
eaf0560ba269 added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
   273
2306
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   274
defaultSelectionBackgroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   275
    "return the default selection background color"
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   276
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   277
    ^DefaultSelectionBackgroundColor
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
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   280
defaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   281
    "return the default selection foreground color"
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   282
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   283
    ^DefaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   284
!
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   285
1477
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   286
defaultViewBackgroundColor
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   287
    "return the default view background"
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   288
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   289
    ^DefaultViewBackground
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   290
!
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   291
3226
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
    ^ LastSearchIgnoredCase
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   294
!
43c19d2a074d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
   295
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   296
lastSearchWasMatch
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   297
    ^ LastSearchWasMatch
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   298
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
   299
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   300
st80SelectMode
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   301
    ^ UserPreferences current st80SelectMode
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   302
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   303
    "Modified: / 03-07-2006 / 16:26:44 / cg"
1729
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
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   306
st80SelectMode:aBoolean
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   307
    UserPreferences current st80SelectMode:aBoolean
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   309
    "Created: / 07-01-1999 / 13:35:24 / cg"
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   310
    "Modified: / 03-07-2006 / 16:27:01 / cg"
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   311
!
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   312
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
   313
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   314
    "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
   315
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   316
    <resource: #style (#'textView.background'
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   317
                       #'text.selectionForegroundColor'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   318
                       #'text.selectionBackgroundColor'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   319
                       #'text.alternativeSelectionForegroundColor'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   320
                       #'text.alternativeSelectionBackgroundColor'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   321
                       #'textView.font'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   322
                       #'text.wordSelectCatchesBlanks'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   323
                       #'text.st80Selections')>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   324
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   325
    DefaultViewBackground := StyleSheet colorAt:'textView.background' default:Color white.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   326
    DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   327
    DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'.
2630
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   328
"/    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
   329
"/    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
   330
    DefaultAlternativeSelectionForegroundColor := DefaultSelectionForegroundColor.
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
   331
    DefaultAlternativeSelectionBackgroundColor := DefaultSelectionBackgroundColor.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   332
    DefaultFont := StyleSheet fontAt:'textView.font'.
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
   333
    MatchDelayTime := 0.6.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   334
    WordSelectCatchesBlanks := StyleSheet at:'text.wordSelectCatchesBlanks' default:false.
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   335
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
   336
    "Modified: / 03-07-2006 / 16:29:42 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   337
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   338
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   339
!TextView class methodsFor:'help specs'!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   340
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   341
flyByHelpSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   342
    "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
   343
     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
   344
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   345
    "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
   346
     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
   347
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   348
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   349
     UIHelpTool openOnClass:TextView
4462
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
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   352
    <resource: #help>
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   353
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   354
    ^ Dictionary new addPairsFrom:#(
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   355
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   356
#matchSearch
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   357
'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
   358
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   359
#searchCaseSensitive
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   360
'Care for case differences'
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   361
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   362
#searchFullWord
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   363
'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
   364
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   365
#searchAtBeginOfLineOnly
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   366
'Search only for the string at the beginning of a line'
5078
e261152d89d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5077
diff changeset
   367
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   368
#searchPattern
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   369
'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
   370
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   371
#searchVariable
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   372
'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
   373
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   374
#replaceText
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   375
'If checked, matching text is replaced by this'
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   376
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   377
#selectLines
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   378
'If checked, lines containing the matched string are selected.'
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   379
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   380
#replacePreserveCase
5727
59553507b326 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5726
diff changeset
   381
'Preserve the title case of replaced text'
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   382
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   383
#replaceAll
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   384
'Search and replace all occurrences of the searched string'
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   385
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   386
#searchWithWrap
5726
04a5c547c98f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5716
diff changeset
   387
'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
   388
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   389
#matchWithRegex
5741
f18b564ed955 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5736
diff changeset
   390
'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
   391
)
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   392
! !
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   393
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   394
!TextView class methodsFor:'interface specs'!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   395
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   396
searchDialogSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   397
    "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
   398
     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
   399
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   400
    "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
   401
     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
   402
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
     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
   405
    "
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
    <resource: #canvas>
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   408
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   409
    ^ 
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   410
    #(FullSpec
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   411
       name: searchDialogSpec
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   412
       window: 
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   413
      (WindowSpec
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   414
         label: 'String search'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   415
         name: 'String search'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   416
         min: (Point 10 10)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   417
         max: (Point 1280 1024)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   418
         bounds: (Rectangle 0 0 475 376)
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   419
       )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   420
       component: 
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   421
      (SpecCollection
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   422
         collection: (
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   423
          (LabelSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   424
             label: 'SearchPattern:'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   425
             name: 'label'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   426
             layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   427
             level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   428
             translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   429
             adjust: left
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   430
           )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   431
          (ComboBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   432
             name: 'patternComboBox'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   433
             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
   434
             activeHelpKey: searchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   435
             tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   436
             model: searchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   437
             immediateAccept: false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   438
             acceptOnLeave: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   439
             acceptOnReturn: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   440
             acceptOnTab: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   441
             acceptOnLostFocus: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   442
             acceptOnPointerLeave: false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   443
             autoSelectInitialText: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   444
             comboList: patternList
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   445
           )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   446
          (VerticalPanelViewSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   447
             name: 'VerticalPanel1'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   448
             layout: (LayoutFrame 0 0.0 52 0 0 1.0 -32 1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   449
             horizontalLayout: fit
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   450
             verticalLayout: top
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   451
             component: 
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   452
            (SpecCollection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   453
               collection: (
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   454
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   455
                   label: 'Case Sensitive'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   456
                   name: 'ignoreCaseCheckBox'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   457
                   activeHelpKey: searchCaseSensitive
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   458
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   459
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   460
                   model: caseSensitive
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   461
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   462
                   extent: (Point 475 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   463
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   464
                (ViewSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   465
                   name: 'MatchBox'
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   466
                   component: 
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   467
                  (SpecCollection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   468
                     collection: (
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   469
                      (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   470
                         label: 'Match (forward only)'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   471
                         name: 'matchCheckBox'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   472
                         layout: (LayoutFrame 0 0 0 0 260 0 0 1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   473
                         activeHelpKey: matchSearch
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   474
                         level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   475
                         tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   476
                         model: match
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   477
                         translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   478
                       )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   479
                      (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   480
                         label: 'Regex Match'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   481
                         name: 'CheckBox6'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   482
                         layout: (LayoutFrame -170 1 0 0 0 1 22 0)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   483
                         activeHelpKey: matchWithRegex
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   484
                         enableChannel: matchWithRegexVisible
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   485
                         model: matchWithRegex
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   486
                         translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   487
                       )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   488
                      )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   489
                    
5791
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
                   extent: (Point 475 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   492
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   493
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   494
                   label: 'Search Full Words'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   495
                   name: 'CheckBox2'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   496
                   activeHelpKey: searchFullWord
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   497
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   498
                   enableChannel: searchFullWordEnabled
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   499
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   500
                   model: searchFullWord
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   501
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   502
                   extent: (Point 475 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   503
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   504
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   505
                   label: 'At Begin of Line Only'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   506
                   name: 'CheckBox5'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   507
                   activeHelpKey: searchAtBeginOfLineOnly
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   508
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   509
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   510
                   model: searchAtBeginOfLineOnly
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   511
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   512
                   extent: (Point 475 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   513
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   514
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   515
                   label: 'Variable Only'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   516
                   name: 'CheckBox1'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   517
                   activeHelpKey: searchVariable
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   518
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   519
                   visibilityChannel: searchVariableVisible
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   520
                   enableChannel: searchVariableEnabled
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   521
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   522
                   model: searchVariable
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   523
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   524
                   labelChannel: stringWithVariableUnderCursorHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   525
                   extent: (Point 475 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   526
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   527
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   528
                   label: 'Select Lines'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   529
                   name: 'CheckBox3'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   530
                   activeHelpKey: selectLines
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   531
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   532
                   initiallyInvisible: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   533
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   534
                   model: selectLinesHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   535
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   536
                   extent: (Point 429 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   537
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   538
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   539
                   label: 'Wrap at End of Text (forward only)'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   540
                   name: 'CheckBox7'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   541
                   activeHelpKey: searchWithWrap
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   542
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   543
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   544
                   model: wrapAtEndOfTextHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   545
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   546
                   extent: (Point 475 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   547
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   548
                (ViewSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   549
                   name: 'Box1'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   550
                   extent: (Point 475 10)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   551
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   552
                (HorizontalPanelViewSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   553
                   name: 'HorizontalPanel1'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   554
                   horizontalLayout: leftFit
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   555
                   verticalLayout: fit
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   556
                   ignoreInvisibleComponents: false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   557
                   elementsChangeSize: true
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   558
                   component: 
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   559
                  (SpecCollection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   560
                     collection: (
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   561
                      (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   562
                         label: 'Replace By:'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   563
                         name: 'CheckBox4'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   564
                         activeHelpKey: replaceText
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   565
                         level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   566
                         enableChannel: replaceEnabled
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   567
                         tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   568
                         model: replaceBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   569
                         translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   570
                         resizeForLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   571
                         useDefaultExtent: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   572
                       )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   573
                      (InputFieldSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   574
                         name: 'ReplaceEntryField'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   575
                         activeHelpKey: replaceText
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   576
                         visibilityChannel: replaceBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   577
                         enableChannel: replaceBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   578
                         model: replaceTextHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   579
                         acceptOnReturn: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   580
                         acceptOnTab: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   581
                         acceptOnPointerLeave: true
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   582
                         extent: (Point 318 24)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   583
                       )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   584
                      )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   585
                    
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   586
                   )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   587
                   extent: (Point 475 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   588
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   589
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   590
                   label: '  Replace All (to End of Text)'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   591
                   name: 'CheckBox8'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   592
                   activeHelpKey: replaceAll
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   593
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   594
                   enableChannel: replaceBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   595
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   596
                   model: replaceAllBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   597
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   598
                   extent: (Point 475 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   599
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   600
                (CheckBoxSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   601
                   label: '  Preserve Case'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   602
                   name: 'CheckBox9'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   603
                   activeHelpKey: replacePreserveCase
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   604
                   level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   605
                   enableChannel: replaceBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   606
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   607
                   model: replacePreserveCaseBoolean
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   608
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   609
                   extent: (Point 475 24)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   610
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   611
                )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   612
              
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   613
             )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   614
           )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   615
          (HorizontalPanelViewSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   616
             name: 'horizontalPanelView'
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   617
             layout: (LayoutFrame 0 0.0 -36 1.0 -16 1.0 0 1.0)
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   618
             level: 0
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   619
             horizontalLayout: fitSpace
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   620
             verticalLayout: center
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   621
             horizontalSpace: 3
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   622
             verticalSpace: 3
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   623
             ignoreInvisibleComponents: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   624
             reverseOrderIfOKAtLeft: true
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   625
             component: 
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   626
            (SpecCollection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   627
               collection: (
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   628
                (ActionButtonSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   629
                   label: 'Cancel'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   630
                   name: 'cancelButton'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   631
                   level: 2
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   632
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   633
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   634
                   model: cancel
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   635
                   useDefaultExtent: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   636
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   637
                (ActionButtonSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   638
                   label: 'Prev'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   639
                   name: 'prevButton'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   640
                   level: 2
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   641
                   translateLabel: true
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: prevAction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   644
                   useDefaultExtent: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   645
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   646
                (ActionButtonSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   647
                   label: 'Next'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   648
                   name: 'nextButton'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   649
                   level: 2
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   650
                   borderWidth: 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   651
                   translateLabel: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   652
                   tabable: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   653
                   model: nextAction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   654
                   isDefault: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   655
                   useDefaultExtent: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   656
                 )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   657
                )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   658
              
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   659
             )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   660
             keepSpaceForOSXResizeHandleH: true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   661
           )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   662
          )
5918
7dcfd80cd61a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5914
diff changeset
   663
        
4767
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   664
       )
011f40f4ece3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
   665
     )
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   666
! !
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   667
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   668
!TextView class methodsFor:'startup'!
121
claus
parents: 120
diff changeset
   669
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   670
open
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   671
    "start an empty TextView"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   672
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   673
    ^ self openWith:nil
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   674
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   675
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   676
openModalOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   677
    "start a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   678
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   679
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   680
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   681
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   682
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   683
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   684
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   685
    "Created: 14.2.1997 / 15:24:12 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   686
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   687
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   688
openModalWith:aString
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   689
    "start a textView with aString as initial contents"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   690
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   691
    ^ self openModalWith:aString title:nil
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   692
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   693
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   694
     TextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   695
     EditTextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   696
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   697
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   698
    "Created: 14.2.1997 / 15:19:04 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   699
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   700
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   701
openModalWith:aString title:aTitle
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   702
    "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
   703
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   704
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   705
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   706
    textView := self setupWith:aString title:aTitle.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   707
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   708
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   709
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   710
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   711
     TextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   712
     EditTextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   713
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   714
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   715
    "Modified: 9.9.1996 / 19:32:29 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   716
    "Created: 14.2.1997 / 15:19:18 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   717
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   718
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   719
openOn:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   720
    "start a textView on a file; return the textView"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   721
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   722
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   723
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   724
    textView := self setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   725
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   726
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   727
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   728
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   729
     TextView openOn:'../../doc/overview.doc'
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   730
     EditTextView openOn:'../../doc/overview.doc'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   731
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   732
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   733
    "Modified: 14.2.1997 / 15:21:51 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   734
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   735
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   736
openOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   737
    "start a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   738
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   739
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   740
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   741
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   742
    textView topView open.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   743
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   744
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   745
    "Created: 14.2.1997 / 15:23:36 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   746
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   747
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   748
openWith:aStringOrStringCollection
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   749
    "start a textView with aStringOrStringCollection as initial contents"
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   750
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   751
    ^ self openWith:aStringOrStringCollection selected:false
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   752
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   753
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   754
     TextView openWith:'some text'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   755
     EditTextView openWith:'some text'
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
   756
     Workspace openWith:'some text'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   757
    "
119
claus
parents: 97
diff changeset
   758
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   759
    "Created: 10.12.1995 / 17:41:32 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   760
    "Modified: 5.3.1997 / 15:37:19 / cg"
126
claus
parents: 121
diff changeset
   761
!
claus
parents: 121
diff changeset
   762
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   763
openWith:aStringOrStringCollection selected:selectedBoolean
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   764
    "start a textView with aStringOrStringCollection as initial (optionally selected) contents.
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   765
     Return the textView."
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   766
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   767
    |textView|
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   768
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   769
    textView := self setupEmpty.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   770
    textView contents:aStringOrStringCollection selected:selectedBoolean.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   771
    textView topView open.
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   772
    ^ textView
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   773
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   774
    "
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   775
     TextView openWith:'some text' selected:true
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   776
     EditTextView openWith:'some text' selected:false
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   777
    "
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   778
!
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   779
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   780
openWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   781
    "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
   782
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   783
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   784
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   785
    textView := self setupWith:aStringOrStringCollection title:aTitle.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   786
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   787
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   788
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   789
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   790
     TextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   791
     EditTextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   792
    "
126
claus
parents: 121
diff changeset
   793
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   794
    "Created: 10.12.1995 / 17:40:02 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   795
    "Modified: 5.3.1997 / 15:37:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   796
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   797
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   798
setupEmpty
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   799
    "create a textview in a topview, with horizontal and
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   800
     vertical scrollbars - a helper for #startWith: and #startOn:"
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
    |top frame label|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   803
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   804
    label := 'unnamed'.
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   805
    top := StandardSystemView label:label icon:self defaultIcon.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   806
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   807
    frame := HVScrollableView
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   808
                for:self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   809
                miniScrollerH:true miniScrollerV:false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   810
                in:top.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   811
    frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   812
    ^ frame scrolledView
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   813
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   814
    "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
   815
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   816
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   817
setupForFile:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   818
    "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
   819
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
   820
    |textView|
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   821
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   822
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   823
    aFileName notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   824
        textView setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   825
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   826
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   827
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   828
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
   829
    "Created: / 14-02-1997 / 15:21:43 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
   830
    "Modified: / 25-10-2006 / 14:46:54 / cg"
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   831
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   832
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   833
setupForModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   834
    "setup a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   835
2793
e4c3cfbe02cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
   836
    |textView|
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   837
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   838
    textView := self setupEmpty.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   839
    textView model:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   840
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   841
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   842
    "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
   843
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   844
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   845
setupWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   846
    "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
   847
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   848
    |top textView|
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   849
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   850
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   851
    top := textView topView.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   852
    aTitle notNil ifTrue:[top label:aTitle].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   853
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   854
    aStringOrStringCollection notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   855
        textView contents:aStringOrStringCollection
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   856
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   857
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   858
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   859
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   860
    "Created: 9.9.1996 / 19:31:22 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   861
    "Modified: 5.3.1997 / 15:37:37 / cg"
119
claus
parents: 97
diff changeset
   862
! !
claus
parents: 97
diff changeset
   863
2744
cb920467a4b4 method category rename
Claus Gittinger <cg@exept.de>
parents: 2740
diff changeset
   864
!TextView methodsFor:'Compatibility-ST80'!
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   865
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   866
displaySelection:aBoolean
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   867
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   868
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   869
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   870
2118
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   871
editText:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   872
    "ST-80 compatibility: set the edited text."
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   873
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   874
    self contents:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   875
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   876
    "Created: / 5.2.2000 / 17:06:18 / cg"
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   877
!
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   878
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   879
selectAndScroll
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   880
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   881
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   882
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   883
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   884
selectFrom:startPos to:endPos
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   885
    "change the selection given two character positions."
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   886
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   887
    self selectFromCharacterPosition:startPos to:endPos
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   888
!
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
   889
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   890
selectionStartIndex
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   891
    "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
   892
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   893
    ^ self characterPositionOfSelection
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   894
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   895
    "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
   896
!
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   897
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   898
selectionStopIndex
2052
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   899
    "ST-80 compatibility: return the character position of
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   900
     the character right after the selection."
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   901
2109
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   902
    |idx|
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   903
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   904
    idx := self characterPositionOfSelectionEnd.
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   905
    idx == 0 ifTrue:[^ 0].
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   906
    ^ idx + 1
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   907
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   908
    "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
   909
! !
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   910
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   911
!TextView methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   912
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   913
characterPositionOfSelection
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   914
    "return the character index of the first character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   915
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   916
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   917
    selectionStartLine isNil ifTrue:[^ 0].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   918
    ^ self characterPositionOfLine:selectionStartLine
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   919
                               col:selectionStartCol
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   920
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   921
    "Modified: 14.8.1997 / 16:35:37 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   922
!
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   923
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   924
characterPositionOfSelectionEnd
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   925
    "return the character index of the last character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   926
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   927
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   928
    selectionStartLine isNil ifTrue:[^ 0].
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   929
    ^ self characterPositionOfLine:selectionEndLine
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
   930
                               col:selectionEndCol
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   931
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   932
    "Created: 14.8.1997 / 16:35:24 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   933
    "Modified: 14.8.1997 / 16:35:45 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   934
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   935
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   936
contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   937
    "return true, if the contents was saved (by a save action),
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   938
     false if not (or was modified again after the last save)."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   939
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   940
    ^ contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   941
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   942
3214
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   943
contentsWasSaved:aBoolean
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   944
    contentsWasSaved := aBoolean
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   945
!
7ab9bba4883d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   946
3212
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   947
defaultFileNameForFileDialog
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   948
    "return the default fileName to use for the save-box"
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   949
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
   950
    ^ defaultFileNameForFileDialog
3212
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   951
!
c14cadfd6752 remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents: 3202
diff changeset
   952
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   953
defaultFileNameForFileDialog:aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   954
    "define the default fileName to use for the save-box"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   955
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   956
    defaultFileNameForFileDialog := aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   957
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   958
    "Created: 13.2.1997 / 18:29:53 / cg"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   959
!
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   960
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   961
directoryForFileDialog:aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   962
    "define the default directory to use for save-box"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   963
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   964
    directoryForFileDialog := aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   965
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   966
    "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
   967
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   968
2941
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   969
externalEncoding
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   970
    "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
   971
     This is (currently only) passed down from the fileBrowser,
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   972
     and required when  utf8/japanese/chinese/korean text is edited.
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   973
     (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
   974
     Notice: this only affects the external representation of the text."
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   975
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   976
    ^ externalEncoding
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   977
!
1df9eff1ddbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2929
diff changeset
   978
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   979
externalEncoding:encodingSymOrNil
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   980
    "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
   981
     via the 'save / save as' dialog.
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   982
     This is (currently only) passed down from the fileBrowser,
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   983
     and required when  utf8/japanese/chinese/korean text is edited.
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
   984
     (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
   985
     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
   986
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   987
    externalEncoding := encodingSymOrNil
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   988
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   989
2581
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   990
parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   991
    "return the value of the instance variable 'parenthesisSpecification' (automatically generated)"
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   992
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   993
    ^ parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   994
!
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   995
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   996
parenthesisSpecification:aDictionary
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   997
    "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
   998
     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
   999
     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
  1000
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1001
    parenthesisSpecification := aDictionary
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1002
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1003
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1004
saveAction:something
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1005
    saveAction := something.
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  1006
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  1007
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  1008
searchBarActionBlock
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  1009
    ^ searchBarActionBlock
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  1010
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  1011
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  1012
searchBarActionBlock:something
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  1013
    searchBarActionBlock := something.
5848
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1014
!
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1015
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1016
textView
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1017
    "added to allow sending textView in any context, where either
5923
608f60d667fa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  1018
     a TextView or a CodeView2 can be encountered. 
608f60d667fa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  1019
     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
  1020
     all messages. 
608f60d667fa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  1021
     Thus, the codeView2 framework always sends codeView2 textView doSomething"
5848
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1022
     
bb14cfcbbd0f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5847
diff changeset
  1023
    ^ self
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1024
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1025
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1026
!TextView methodsFor:'accessing-contents'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1027
2791
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1028
contents:newContents selected:selectedBoolean
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1029
    self contents:newContents.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1030
    selectedBoolean ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1031
        list size == 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1032
            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
  1033
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1034
            self selectAll
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1035
        ]
2791
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1036
    ]
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1037
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1038
    "
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1039
     |w|
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1040
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1041
     w := Workspace new open.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1042
     w contents:'Hello world' selected:true.
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1043
    "
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1044
!
09e73617cc09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  1045
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1046
fromFile:aFileName
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1047
    "take contents from a named file"
3724
5db1580f82ba mark obsolete message
Stefan Vogel <sv@exept.de>
parents: 3708
diff changeset
  1048
    <resource: #obsolete>
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1049
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1050
    self obsoleteMethodWarning.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1051
    ^ self loadTextFile:aFileName.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1052
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1053
    "Modified: / 25-10-2006 / 14:47:35 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1054
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1055
4755
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1056
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1057
    "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
  1058
     Redefined since changing the contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1059
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1060
    self unselect.
4755
d47ae92cc09f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4748
diff changeset
  1061
    super list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1062
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1063
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1064
loadTextFile:aFileName
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1065
    "take contents from a named file"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1066
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1067
    |f|
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1068
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1069
    f := aFileName asFilename.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1070
    self directoryForFileDialog:(f directoryName).
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1071
    self contents:(f contents)
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1072
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1073
    "Created: / 25-10-2006 / 14:44:01 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1074
!
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1075
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1076
setContents:something
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1077
    "set the contents (either a string or a Collection of strings)
5955
72e55279ce07 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5923
diff changeset
  1078
     don't change the position (i.e. do not scroll) or the selection."
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1079
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1080
    |selStartLine selStartCol selEndLine selEndCol selStyle|
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1081
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1082
    selStartLine := selectionStartLine.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1083
    selStartCol := selectionStartCol.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1084
    selEndLine := selectionEndLine.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1085
    selEndCol := selectionEndCol.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1086
    selStyle := selectStyle.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1087
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1088
    super setContents:something.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1089
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1090
    selStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1091
        self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1092
            selectFromLine:selStartLine col:selStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1093
            toLine:selEndLine col:selEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1094
        selectStyle := selStyle
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1095
    ].
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1096
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1097
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1098
    "Modified: / 31.3.1998 / 23:33:21 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1099
!
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1100
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1101
setList:something
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1102
    "set the displayed contents (a collection of strings)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1103
     without redraw.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1104
     Redefined since changing contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1105
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1106
    self unselect.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1107
    super setList:something
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1108
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1109
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1110
setupForFile:aFileName
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1111
    "take contents from a named file"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1112
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1113
    |baseName|
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1114
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1115
    self loadTextFile:aFileName.
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1116
    aFileName notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1117
        baseName := aFileName asFilename baseName.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1118
        self topView label:baseName.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1119
        self defaultFileNameForFileDialog:baseName.
3417
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1120
    ].
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1121
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1122
    "Created: / 25-10-2006 / 14:47:13 / cg"
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1123
!
44c33c650dc0 fromFile setup code cleanup
Claus Gittinger <cg@exept.de>
parents: 3399
diff changeset
  1124
1487
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1125
text
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1126
    "for ST80 compatibility"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1127
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1128
    ^ self contents
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1129
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1130
    "Created: / 19.4.1998 / 12:53:10 / cg"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1131
!
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
  1132
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1133
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
  1134
    "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
  1135
     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
  1136
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1137
    |beginCol endCol endLine thisCharacter flag|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1138
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1139
    flag := #word.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1140
    beginCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1141
    endCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1142
    endLine := selectLine.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1143
    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
  1144
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1145
    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
  1146
    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
  1147
    endCol == 0 ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1148
        endLine := selectLine + 1
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1149
    ].
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1150
1750
d87cc464fde2 comment
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1151
    "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
  1152
    (wordCheck value:thisCharacter) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1153
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1154
         try to catch a blank ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1155
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1156
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1157
        WordSelectCatchesBlanks ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1158
            ((beginCol == 1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1159
            or:[(self characterAtLine:selectLine col:(beginCol - 1))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1160
                 ~~ Character space]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1161
                ((self characterAtLine:selectLine col:(endCol + 1))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1162
                  == Character space) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1163
                    endCol := endCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1164
                    flag := #wordRight
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1165
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1166
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1167
                beginCol := beginCol - 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1168
                flag := #wordLeft
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1169
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1170
        ].
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1171
    ].
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1172
    aFiveArgBlock value:selectLine
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1173
                  value:beginCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1174
                  value:endLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1175
                  value:endCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1176
                  value:flag
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1177
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1178
    "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
  1179
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1180
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1181
!TextView methodsFor:'accessing-look'!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1182
2027
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1183
selectionBackgroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1184
    "return the selection-background color."
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1185
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1186
    ^ selectionBgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1187
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1188
5847
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1189
selectionBackgroundColor:aColor
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1190
    "set the selection-background color.
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1191
     The default is defined by the styleSheet;
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1192
     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
  1193
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1194
    selectionBgColor := aColor onDevice:device.
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1195
    self hasSelection ifTrue:[
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1196
        self invalidate
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1197
    ]
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1198
!
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1199
2027
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1200
selectionForegroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1201
    "return the selection-foreground color."
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1202
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1203
    ^ selectionFgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1204
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1205
5847
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1206
selectionForegroundColor:aColor
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1207
    "set the selection-foreground color.
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1208
     The default is defined by the styleSheet;
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1209
     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
  1210
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1211
    selectionFgColor := aColor onDevice:device.
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1212
    self hasSelection ifTrue:[
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1213
        self invalidate
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1214
    ]
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1215
!
8dadbf008f64 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5845
diff changeset
  1216
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1217
selectionForegroundColor:color1 backgroundColor:color2
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1218
    "set both the selection-foreground and cursor background colors.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1219
     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
  1220
     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
  1221
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1222
    selectionFgColor := color1 onDevice:device.
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1223
    selectionBgColor := color2 onDevice:device.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2900
diff changeset
  1224
    self hasSelection ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1225
        self invalidate
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1226
    ]
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1227
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 715
diff changeset
  1228
    "Modified: 29.5.1996 / 16:22:15 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1229
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1230
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1231
!TextView methodsFor:'accessing-mvc'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1232
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1233
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
  1234
    "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
  1235
     and selection. Added for ST-80 compatibility"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1236
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1237
    aspectSym notNil ifTrue:[aspectMsg := aspectSym.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1238
                             listMsg isNil ifTrue:[listMsg := aspectSym]].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1239
    changeSym notNil ifTrue:[changeMsg := changeSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1240
    listSym notNil ifTrue:[listMsg := listSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1241
    menuSym notNil ifTrue:[menuMsg := menuSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1242
"/    initial notNil ifTrue:[initialSelectionMsg := initial].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1243
    self model:aModel.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1244
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1245
    "Modified: 15.8.1996 / 12:52:54 / stefan"
906
a8b9b481ce70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1246
    "Modified: 2.1.1997 / 16:11:28 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1247
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1248
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1249
!TextView methodsFor:'drag & drop'!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1250
96256221e3af support drag
ca
parents: 2581
diff changeset
  1251
allowDrag:aBoolean
96256221e3af support drag
ca
parents: 2581
diff changeset
  1252
    "enable/disable dragging support
96256221e3af support drag
ca
parents: 2581
diff changeset
  1253
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  1254
    aBoolean ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1255
        dropSource := nil.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1256
    ] ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1257
        dropSource isNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1258
            dropSource := DropSource
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1259
                            receiver:self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1260
                            argument:nil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1261
                            dropObjectSelector:#collectionOfDragObjects
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1262
                            displayObjectSelector:nil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1263
        ]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1264
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  1265
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1266
96256221e3af support drag
ca
parents: 2581
diff changeset
  1267
canDrag
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1268
    "returns true if dragging is enabled"
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1269
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1270
    ^ dropSource notNil and:[ self hasSelection ]
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1271
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  1272
    "Modified (comment): / 12-02-2012 / 08:37:21 / cg"
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1273
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1274
96256221e3af support drag
ca
parents: 2581
diff changeset
  1275
collectionOfDragObjects
96256221e3af support drag
ca
parents: 2581
diff changeset
  1276
    "returns collection of dragable objects assigned to selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  1277
     Here, by default, a collection of text-dragObjects is generated;
96256221e3af support drag
ca
parents: 2581
diff changeset
  1278
     however, if a dragObjectConverter is defined, that one gets a chance
96256221e3af support drag
ca
parents: 2581
diff changeset
  1279
     to convert as appropriate.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1280
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  1281
    |selection|
96256221e3af support drag
ca
parents: 2581
diff changeset
  1282
96256221e3af support drag
ca
parents: 2581
diff changeset
  1283
    selection := self selection.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1284
96256221e3af support drag
ca
parents: 2581
diff changeset
  1285
    selection size == 0 ifTrue:[^ nil].
5249
cc785134a690 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1286
    ^ Array with:(DropObject newText:selection).
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1287
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1288
96256221e3af support drag
ca
parents: 2581
diff changeset
  1289
dropSource
3245
b17c15b61e94 ugly comments
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  1290
    "returns the dropSource or nil"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1291
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1292
    ^ dropSource
96256221e3af support drag
ca
parents: 2581
diff changeset
  1293
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  1294
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1295
dropSource:aDropSourceOrNil
3245
b17c15b61e94 ugly comments
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  1296
    "set the dropSource or nil"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1297
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1298
    dropSource := aDropSourceOrNil.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1299
! !
96256221e3af support drag
ca
parents: 2581
diff changeset
  1300
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1301
!TextView methodsFor:'encoding'!
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1302
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1303
validateFontEncodingFor:newEncoding ask:ask
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1304
    "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
  1305
     which is able to display text encoded as specified by newEncoding"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1306
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1307
    |fontsEncoding msg filter f defaultFont pref matchingFonts
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1308
     matchingFamilyFonts matchingFamilyFaceFonts matchingFamilyFaceStyleFonts
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1309
     matchingFamilyFaceStyleSizeFonts font|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1310
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  1311
    font := gc font.
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1312
    fontsEncoding := font encoding.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1313
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1314
    pref := FontDescription preferredFontEncodingFor:newEncoding.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1315
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1316
    (pref match:fontsEncoding) ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1317
        ^ self
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1318
    ].
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1319
    (fontsEncoding notNil and:[CharacterEncoder isEncoding:pref subSetOf:fontsEncoding]) ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1320
        ^ self
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1321
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1322
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1323
    filter := [:f | |coding|
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1324
                    (coding := f encoding) notNil
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1325
                    and:[pref match:coding]].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1326
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1327
    device flushListOfAvailableFonts.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1328
    matchingFonts := device listOfAvailableFonts select:filter.
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1329
    matchingFamilyFonts := matchingFonts select:[:f | f family = font family].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1330
    matchingFamilyFaceFonts := matchingFamilyFonts select:[:f | f face = font face].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1331
    matchingFamilyFaceStyleFonts := matchingFamilyFaceFonts select:[:f | f style = font style].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1332
    matchingFamilyFaceStyleSizeFonts := matchingFamilyFaceStyleFonts select:[:f | f size = font size].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1333
    matchingFamilyFaceStyleSizeFonts size > 0 ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1334
        defaultFont := matchingFamilyFaceStyleSizeFonts first
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1335
    ] ifFalse:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1336
        matchingFamilyFaceStyleFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1337
            defaultFont := matchingFamilyFaceStyleFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1338
        ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1339
            matchingFamilyFaceFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1340
                defaultFont := matchingFamilyFaceFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1341
            ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1342
                matchingFamilyFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1343
                    defaultFont := matchingFamilyFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1344
                ] ifFalse:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1345
                    matchingFonts size > 0 ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1346
                        defaultFont := matchingFonts first
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1347
                    ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1348
                ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1349
            ].
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1350
        ].
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1351
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1352
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1353
    defaultFont isNil ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1354
        defaultFont isNil ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1355
            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
  1356
            pref := #'iso10646-1'.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1357
        ]
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1358
    ].
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1359
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1360
    msg := 'Switch to a %1 encoded font ?'.
3189
945a221e5cb2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3045
diff changeset
  1361
    (ask not or:[self confirm:(resources stringWithCRs:msg with:pref)])
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1362
    ifTrue:[
5412
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1363
        self withWaitCursorDo:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1364
            f := FontPanel
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1365
                    fontFromUserInitial:defaultFont
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1366
                    title:(resources string:'Font selection')
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1367
                    filter:filter
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1368
                    encoding:pref.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1369
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1370
            f notNil ifTrue:[
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1371
                self font:f.
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1372
            ]
d248d42bac05 class: TextView
Stefan Vogel <sv@exept.de>
parents: 5391
diff changeset
  1373
        ]
2881
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1374
    ]
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1375
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1376
    "Created: 26.10.1996 / 12:06:54 / cg"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1377
    "Modified: 30.6.1997 / 17:46:46 / cg"
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1378
! !
0c8e7e9edc0a encoding stuff
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1379
2752
5650a9ab5935 method category rename
Claus Gittinger <cg@exept.de>
parents: 2744
diff changeset
  1380
!TextView methodsFor:'event handling'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1381
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1382
buttonMotion:buttonState x:x y:y
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1383
    "mouse-move while button was pressed - handle selection changes"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1384
3219
e8c7679a8a94 buttonrelease behavior, when released in another view
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
  1385
    (clickLine isNil or:[clickPos isNil]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1386
        dragIsActive := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1387
        ^ self
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1388
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  1389
96256221e3af support drag
ca
parents: 2581
diff changeset
  1390
    dragIsActive ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1391
        (clickPos dist:(x@y)) >= 5.0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1392
            dragIsActive := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1393
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1394
            self hasSelection ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1395
                dropSource startDragIn:self at:(x@y)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1396
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1397
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1398
        ^ self
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1399
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1400
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1401
    "is it the select or 1-button ?"
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1402
    buttonState == 0 ifTrue:[^ self].
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1403
    self sensor leftButtonPressed ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1404
        "/ self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1405
        "/ self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1406
        ^ self
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1407
    ].
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1408
"/    (device buttonMotionMask:buttonState includesButton:#select) ifFalse:[
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  1409
"/        (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
  1410
"/            ^ self
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1411
"/        ].
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1412
"/    ].
53
b587b15eafab *** empty log message ***
claus
parents: 45
diff changeset
  1413
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1414
    "if moved outside of view, start autoscroll"
3202
8217b0acc9f2 select from beginning (in editField
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
  1415
4160
a9c329c2784d changed: buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 4156
diff changeset
  1416
    ((y < 0) and:[firstLineShown ~~ 0]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1417
        self compressMotionEvents:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1418
        (self startAutoScrollUp:y negated) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1419
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1420
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1421
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1422
    (y > height) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1423
        self compressMotionEvents:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1424
        (self startAutoScrollDown:(y - height)) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1425
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1426
        ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1427
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  1428
    ((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1429
        self compressMotionEvents:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1430
        (self startAutoScrollLeft:x) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1431
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1432
        ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1433
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
  1434
    (x > width) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1435
        self compressMotionEvents:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1436
        (self startAutoScrollRight:(x - width)) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1437
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1438
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1439
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1440
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1441
    "move inside - stop autoscroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1442
    autoScrollBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1443
        self stopScrollSelect
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1444
    ].
3220
246c5a3bfefa oops - leftover prints
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
  1445
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1446
    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
  1447
4160
a9c329c2784d changed: buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 4156
diff changeset
  1448
    "Modified: / 08-08-2010 / 11:20:54 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1449
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1450
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1451
buttonMultiPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1452
    "multi-mouse-click - select word under pointer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1453
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1454
    (button == 1) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1455
        clickPos := x @ y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1456
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1457
        "/ 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
  1458
"/        self clearSearchAction.
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  1459
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1460
        clickCount notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1461
            clickCount := clickCount + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1462
            (clickCount == 2) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1463
                self doubleClickX:x y:y
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1464
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1465
                (clickCount == 3) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1466
                    self tripleClickX:x y:y
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1467
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1468
                    (clickCount == 4) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1469
                        self quadClickX:x y:y
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1470
                    ]
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
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1474
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1475
        super buttonMultiPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1476
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1477
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1478
    "Modified: 11.9.1997 / 04:15:35 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1479
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1480
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1481
buttonPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1482
    "mouse-click - prepare for selection change"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1483
1308
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1484
    |sensor clickVisibleLine|
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1485
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1486
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1487
    sensor       := self sensor.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1488
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1489
    (button == 1) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1490
        sensor shiftDown ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1491
            "mouse-click with shift - adding to selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1492
            self extendSelectionToX:x y:y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1493
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1494
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1495
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1496
        clickVisibleLine := self visibleLineOfY:y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1497
        clickPos := x @ y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1498
        clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1499
        clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1500
        clickStartLine := clickLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1501
        clickStartCol := clickCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1502
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1503
        (self canDrag
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1504
        and:[(self isInSelection:clickLine col:clickCol)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1505
        and:[UserPreferences current startTextDragWithControl not
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1506
             or:[sensor ctrlDown]]]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1507
            dragIsActive := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1508
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1509
            self unselect.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1510
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1511
        clickCount := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1512
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1513
        super buttonPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1514
    ]
813
7168eda47e3b Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 770
diff changeset
  1515
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1516
    "Modified: / 20.5.1999 / 17:02:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1517
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1518
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1519
buttonRelease:button x:x y:y
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1520
    "mouse- button release - turn off autoScroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1521
3914
ceb85ec53629 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3909
diff changeset
  1522
    (button == 1) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1523
        self hasSelection ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1524
            self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1525
            self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1526
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1527
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1528
        autoScrollBlock notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1529
            self stopScrollSelect
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1530
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1531
        dragIsActive ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1532
            self unselect
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1533
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1534
        clickPos := nil.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1535
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1536
        super buttonRelease:button x:x y:y
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1537
    ].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1538
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1539
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1540
    "/ clickPos := clickLine := clickCol := nil.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1541
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1542
    "Modified: / 20.5.1999 / 17:14:23 / cg"
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1543
!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1544
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1545
doubleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1546
    "double-click - select word under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1547
3588
a70267e5b501 st80 behavior: also scan for matching single quote
Claus Gittinger <cg@exept.de>
parents: 3587
diff changeset
  1548
    |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
  1549
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1550
    self selectWordAtX:x y:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1551
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1552
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1553
     special - if clicked on a parenthesis, select to matching
4702
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1554
     (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
  1555
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1556
    ((sel := self selection) size == 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1557
    and:[(sel := sel at:1) size == 1]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1558
        ch := sel at:1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1559
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1560
        ((self isOpeningParenthesis:ch)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1561
        or:[ (self isClosingParenthesis:ch) ]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1562
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1563
                searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1564
                ifFound:[:line :col |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1565
                              |prevLine prevCol moveBack pos1|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1566
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1567
                              prevLine := firstLineShown.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1568
                              prevCol := viewOrigin x.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1569
                              self selectFromLine:selectionStartLine col:selectionStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1570
                                           toLine:line col:col.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1571
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1572
                              self sensor ctrlDown ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1573
                                  "/ undo scroll operation ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1574
                                  self withCursor:Cursor eye do:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1575
                                      |delayCount|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1576
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1577
                                      moveBack := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1578
                                      (self isClosingParenthesis:ch) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1579
                                           (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1580
                                               moveBack := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1581
                                           ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1582
                                      ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1583
                                           selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1584
                                               self makeLineVisible:selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1585
                                               moveBack := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1586
                                           ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1587
                                      ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1588
                                      moveBack ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1589
                                           delayCount  := 0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1590
                                           pos1 := x@y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1591
                                           self invalidateRepairNow:true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1592
                                           Delay waitForSeconds:MatchDelayTime.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1593
                                           delayCount := delayCount + MatchDelayTime.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1594
                                           [self sensor hasUserEventFor:self] whileFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1595
                                                Delay waitForSeconds:MatchDelayTime / 2.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1596
                                                delayCount := delayCount + (MatchDelayTime / 2).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1597
                                                delayCount > 2 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1598
                                                    self cursor:Cursor eyeClosed.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1599
                                                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1600
                                                delayCount >= 2.3 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1601
                                                    self cursor:Cursor eye.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1602
                                                    delayCount := 0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1603
                                                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1604
                                           ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1605
                                           self scrollToLine:prevLine; scrollToCol:prevCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1606
                                      ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1607
                                  ]
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
                              ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1610
                          ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1611
                ifNotFound:[self showNotFound]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1612
                onError:[self beep]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1613
                openingCharacters:((parenthesisSpecification at:#open) ", '([{'")
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1614
                closingCharacters:((parenthesisSpecification at:#close) ", ')]}'").
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1615
            selectStyle := nil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1616
        ]
4702
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1617
    ].
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1618
02d7770b3206 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4667
diff changeset
  1619
    (self st80SelectMode or:[ self sensor ctrlDown]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1620
        "/ st80 selects:
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1621
        "/   - if clicked right after a parenthesis -> select to matching parenthesis
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1622
        "/   - 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
  1623
        "/   - if clicked at beginning of the line  -> select that line
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1624
        "/   - if clicked at the top of the text    -> select all
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1625
        "/ 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
  1626
        clickCol == 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1627
            clickLine == 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1628
                self selectAll.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1629
                ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1630
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1631
            self selectLineAtY:y.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1632
            selectStyle := #line.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1633
            ^ self
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
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1636
        matchCol := nil.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1637
        "/ see what is to the left of that character ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1638
        clickCol > 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1639
            ch := self characterAtLine:clickLine col:clickCol-1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1640
            (self isOpeningParenthesis:ch) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1641
                matchCol := clickCol - 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1642
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1643
                ('"''|' includes:ch) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1644
                    scanCol := clickCol - 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1645
                    fwdScan := true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1646
                    scanCh := ch.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1647
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1648
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1649
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1650
        fwdSelect := true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1651
        (matchCol isNil and:[scanCol isNil]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1652
            clickCol < (self listAt:clickLine) size ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1653
                ch := self characterAtLine:clickLine col:clickCol+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1654
                (self isClosingParenthesis:ch) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1655
                    matchCol := clickCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1656
                    fwdSelect := false.
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
                    ('"''|' includes:ch) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1659
                        scanCol := clickCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1660
                        fwdScan := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1661
                        scanCh := ch.
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
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1664
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1665
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1666
        matchCol notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1667
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1668
                searchForMatchingParenthesisFromLine:clickLine col:matchCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1669
                ifFound:[:line :col |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1670
                          self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1671
                                       toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1672
                ifNotFound:[self showNotFound]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1673
                onError:[self beep]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1674
                openingCharacters:((parenthesisSpecification at:#open) , '([{')
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1675
                closingCharacters:((parenthesisSpecification at:#close) , ')]}').
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1676
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1677
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1678
        scanCol notNil ifTrue:[
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  1679
            "/ if it's an EOL comment, do it differently
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1680
            ch := self characterAtLine:clickLine col:clickCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1681
            ch == $/ ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1682
                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
  1683
                ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1684
            ].
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
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1687
                scanFor:scanCh fromLine:clickLine col:scanCol forward:fwdScan
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1688
                ifFound:[:line :col |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1689
                            |selStart selEnd|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1690
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1691
                            fwdScan ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1692
                                selStart := scanCol+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1693
                                selEnd := col-1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1694
                            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1695
                                selStart := scanCol-1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1696
                                selEnd := col+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1697
                            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1698
                            self selectFromLine:clickLine col:selStart
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1699
                                 toLine:line col:selEnd.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1700
                            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1701
                           ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1702
                ifNotFound:[self showNotFound].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1703
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1704
        ]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1705
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1706
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1707
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1708
     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
  1709
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1710
    wordStartLine := selectionStartLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1711
    wordEndLine := selectionEndLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1712
    selectStyle == #wordLeft ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1713
        wordStartCol := selectionStartCol + 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1714
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1715
        wordStartCol := selectionStartCol.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1716
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1717
    selectStyle == #wordRight ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1718
        wordEndCol := selectionEndCol - 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1719
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1720
        wordEndCol := selectionEndCol
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1721
    ]
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1722
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  1723
    "Created: / 11-09-1997 / 04:12:55 / cg"
4255
9bf0cc2595a9 changed: #doubleClickX:y:
Claus Gittinger <cg@exept.de>
parents: 4254
diff changeset
  1724
    "Modified: / 14-06-2011 / 14:04:59 / cg"
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  1725
    "Modified (format): / 13-02-2017 / 20:32:08 / cg"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1726
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1727
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1728
extendSelectionToX:x y:y
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1729
    "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
  1730
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1731
    self extendSelectionToX:x y:y setPrimarySelection:true
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1732
!
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1733
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1734
extendSelectionToX:x y:y setPrimarySelection:aBoolean
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1735
    "mouse-move while button was pressed - handle selection changes"
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1736
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1737
    |movedVisibleLine movedLine movedCol
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1738
     movedUp
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1739
     oldStartLine oldEndLine oldStartCol oldEndCol|
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1740
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1741
    movedVisibleLine := self visibleLineOfY:y.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1742
    movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1743
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1744
    (x < leftMargin) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1745
        movedCol := 0
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1746
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1747
        movedCol := self colOfX:x inVisibleLine:movedVisibleLine
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1748
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1749
    y < 0 ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1750
        movedCol := 0
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1751
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1752
    ((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1753
        selectionStartLine notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1754
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1755
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1756
        (clickPos isNil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1757
        or:[(clickPos x - x) abs < 3
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1758
            and:[(clickPos y - y) abs < 3]]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1759
            ^ self
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
        selectionStartLine := clickLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1762
        selectionStartCol := clickCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1763
        selectionEndLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1764
        selectionEndCol := selectionStartCol.
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
        oldStartLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1767
        oldEndLine := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1768
        oldStartCol := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1769
        oldEndCol := selectionEndCol-1.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1770
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1771
        selectionStartLine isNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1772
            selectionStartLine := selectionEndLine := clickLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1773
            selectionStartCol := selectionEndCol := clickCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1774
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1775
        oldStartLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1776
        oldEndLine := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1777
        oldStartCol := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1778
        oldEndCol := selectionEndCol.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1779
    ].
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1780
    oldEndLine isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1781
        oldEndLine := selectionEndLine ? clickLine ? movedLine.
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1782
    ].
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1783
    oldEndCol isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1784
        oldEndCol := selectionEndCol ? clickCol.
3692
6527b20d26b5 extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1785
    ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1786
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1787
    "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
  1788
    movedUp := false.
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1789
    clickStartLine isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1790
        clickStartLine := movedLine.
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1791
    ].
3505
cdb364dede3e extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
  1792
    clickStartCol isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1793
        clickStartCol := movedCol.
3505
cdb364dede3e extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
  1794
    ].
3443
09a7671630a9 changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 3438
diff changeset
  1795
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1796
    (movedLine < clickStartLine) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1797
        movedUp := true
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1798
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1799
        (movedLine == clickStartLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1800
            (movedCol < clickStartCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1801
                movedUp := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1802
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1803
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1804
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1805
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1806
    movedUp ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1807
        "change selectionStart"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1808
        selectionStartCol := movedCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1809
        selectionStartLine := movedLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1810
        selectionEndCol := clickStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1811
        selectionEndLine := clickStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1812
        selectStyle notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1813
            selectionEndCol := wordEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1814
            selectionEndLine := wordEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1815
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1816
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1817
        "change selectionEnd"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1818
        selectionEndCol := movedCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1819
        selectionEndLine := movedLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1820
        selectionStartCol := clickStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1821
        selectionStartLine := clickStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1822
        selectStyle notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1823
            selectionStartCol := wordStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1824
            selectionStartLine := wordStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1825
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1826
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1827
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1828
    selectionStartLine isNil ifTrue:[^ self].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1829
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1830
    (selectionStartCol == 0) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1831
        selectionStartCol := 1
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1832
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1833
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1834
    "
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1835
     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
  1836
    "
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1837
    (selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1838
        movedUp ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1839
            selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1840
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1841
            selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1842
            selectionEndCol == 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1843
                selectionEndLine := selectionEndLine + 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1844
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1845
        ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1846
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1847
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1848
    selectStyle == #line ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1849
        movedUp ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1850
            selectionStartCol := 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1851
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1852
            selectionEndCol := 0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1853
            selectionEndLine := selectionEndLine + 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1854
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1855
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1856
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1857
    self validateNewSelection.
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1858
    aBoolean ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1859
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1860
        self selectionChanged.
4885
c2cd790c43d3 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4864
diff changeset
  1861
    ].
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1862
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  1863
    "/ 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
  1864
"/    self clearSearchAction.
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1865
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1866
    (oldStartLine == selectionStartLine) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1867
        (oldStartCol ~~ selectionStartCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1868
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1869
                redrawLine:oldStartLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1870
                      from:((selectionStartCol min:oldStartCol) max:1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1871
                        to:((selectionStartCol max:oldStartCol) max:1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1872
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1873
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1874
        self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1875
            redrawFromLine:(oldStartLine?selectionStartLine min:selectionStartLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1876
                        to:(oldStartLine?selectionStartLine max:selectionStartLine)
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1877
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1878
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1879
    (oldEndLine == selectionEndLine) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1880
        (oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1881
            self redrawLine:oldEndLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1882
                       from:((selectionEndCol min:oldEndCol) max:1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1883
                         to:((selectionEndCol max:oldEndCol) max:1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1884
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1885
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1886
        selectionEndLine isNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1887
            selectionStartLine := nil.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1888
            self redraw.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1889
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1890
            (selectionStartLine notNil) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1891
                self redrawFromLine:(oldEndLine min:selectionEndLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1892
                                 to:(oldEndLine max:selectionEndLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1893
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1894
        ]
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1895
    ].
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1896
    clickLine := movedLine.
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1897
    clickCol := movedCol
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1898
4234
65f202270d2c changed: #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents: 4178
diff changeset
  1899
    "Modified: / 05-04-2011 / 17:13:35 / cg"
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  1900
    "Modified: / 17-04-2012 / 21:00:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3251
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1901
!
156d3ee6a6c1 fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1902
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1903
keyPress:key x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1904
    "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
  1905
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1906
    <resource: #keyboard (#Find #Copy #FindNext #FindPrev #FindAgain
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1907
                          #GotoLine #SelectAll #SaveAs #Print
6204
44cc5203397e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6202
diff changeset
  1908
                          #OpenWorkspaceOnIt
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1909
                          #'F*' #'f*')>
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1910
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1911
    (key == #Find) ifTrue:[self search. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1912
    (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
  1913
    (key == #GotoLine) ifTrue:[self gotoLine. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1914
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1915
    (key == #FindNext) ifTrue:[self searchFwd. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1916
    (key == #FindPrev) ifTrue:[self searchBwd. ^self].
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1917
    (key == #FindAgain) ifTrue:[self searchAgainInSameDirection. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1918
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1919
    (key == #SelectAll) ifTrue:[self selectAll. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1920
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1921
    (key == #SaveAs)    ifTrue:[self save.    ^self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1922
    (key == #Print)     ifTrue:[self doPrint. ^self].
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  1923
6204
44cc5203397e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6202
diff changeset
  1924
    (key == #OpenWorkspaceOnIt) ifTrue:[self openWorkspaceWithIt. ^self].
44cc5203397e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6202
diff changeset
  1925
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1926
    "
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1927
     shift-Fn defines a key-sequence
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1928
     Fn       pastes that sequence
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1929
     cmd-Fn   performs a 'doIt' on the sequence (Workspaces only)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1930
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1931
     (see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1932
    "
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  1933
    (key notEmptyOrNil and:[(key at:1) asLowercase == $f]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1934
        (('[fF][0-9]' match:key)
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  1935
         or:['[fF][0-9][0-9]' match:key]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1936
            self sensor shiftDown ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1937
                UserPreferences current functionKeySequences
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1938
                    at:key put:(self selection)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1939
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1940
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1941
        ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1942
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1943
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1944
    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
  1945
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  1946
    "Modified (format): / 30-03-2017 / 22:35:58 / stefan"
6204
44cc5203397e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6202
diff changeset
  1947
    "Modified: / 01-09-2017 / 14:32:27 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1948
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1949
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  1950
mapped
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1951
    super mapped.
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1952
    selectionFgColor := selectionFgColor onDevice:device.
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1953
    selectionBgColor := selectionBgColor onDevice:device.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1954
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1955
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1956
quadClickX:x y:y
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1957
    "quadrupleClick-click - select all"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1958
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1959
    self selectAll
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1960
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1961
    "Created: / 11.9.1997 / 04:15:24 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1962
    "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
  1963
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1964
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1965
tripleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1966
    "triple-click - select line under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1967
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1968
    self selectLineAtY:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1969
    selectStyle := #line
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1970
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1971
    "Created: 11.9.1997 / 04:13:37 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1972
! !
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1973
2120
1054ce5c8fe7 category change
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
  1974
!TextView methodsFor:'initialization & release'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1975
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1976
fetchDeviceResources
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1977
    "fetch device colors, to avoid reallocation at redraw time"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1978
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1979
    super fetchDeviceResources.
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1980
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1981
    selectionFgColor notNil ifTrue:[selectionFgColor := selectionFgColor onDevice:device].
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1982
    selectionBgColor notNil ifTrue:[selectionBgColor := selectionBgColor onDevice:device].
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1983
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1984
    "Created: 14.1.1997 / 00:14:33 / cg"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1985
!
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1986
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1987
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1988
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1989
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1990
    super initStyle.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1991
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1992
    viewBackground := DefaultViewBackground.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1993
    selectionFgColor := DefaultSelectionForegroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1994
    selectionFgColor isNil ifTrue:[selectionFgColor := bgColor].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1995
    selectionBgColor := DefaultSelectionBackgroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1996
    selectionBgColor isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1997
        device hasColors ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1998
            DefaultSelectionForegroundColor isNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  1999
                selectionFgColor := fgColor
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2000
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2001
            selectionBgColor := Color green
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2002
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2003
            device hasGrayscales ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2004
                DefaultSelectionForegroundColor isNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2005
                    selectionFgColor := fgColor
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2006
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2007
                selectionBgColor := Color gray
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2008
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2009
                selectionBgColor := fgColor
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2010
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2011
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2012
    ].
708
e8eb52699f90 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  2013
4321
4c8c94f6e1c6 comemnt in: #initStyle
az
parents: 4310
diff changeset
  2014
    "Modified: / 22-01-1997 / 11:57:53 / cg"
4c8c94f6e1c6 comemnt in: #initStyle
az
parents: 4310
diff changeset
  2015
    "Modified (comment): / 05-10-2011 / 15:50:45 / az"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2016
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2017
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2018
initialize
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2019
    super initialize.
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2020
    self initializeSaveAction.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2021
    contentsWasSaved := false.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  2022
    dragIsActive     := false.
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2023
    lastSearchWasMatch := lastSearchWasVariableSearch := false.
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2024
    lastSearchIgnoredCase := true.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2025
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2026
    parenthesisSpecification isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2027
        parenthesisSpecification := DefaultParenthesisSpecification.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2028
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2029
911
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  2030
    "I handle menus myself"
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  2031
    menuHolder := menuPerformer := self.
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  2032
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  2033
    "/ on default allow drag
96256221e3af support drag
ca
parents: 2581
diff changeset
  2034
    self allowDrag:true.
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2035
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2036
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2037
initializeSaveAction
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2038
    saveAction := [ self openSaveDialog ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2039
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2040
4450
ef24b9b60ec1 category of:21 methods
Claus Gittinger <cg@exept.de>
parents: 4437
diff changeset
  2041
!TextView methodsFor:'menu & menu actions'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2042
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2043
appendTo:aFileName
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2044
    "append contents to a file named fileName"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2045
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2046
    |aStream msg filename|
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2047
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2048
    filename := aFileName asFilename.
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2049
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2050
    (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2051
        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
  2052
        self warn:(msg , '\\(ST/X internal permission check)' ) withCRs.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2053
        ^ self
2036
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  2054
    ].
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  2055
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2056
    [
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2057
        aStream := filename appendingWriteStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2058
        [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2059
            self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2060
        ] ensure:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2061
            aStream close.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2062
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2063
        contentsWasSaved := true
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2064
    ] on:FileStream openErrorSignal do:[:ex|
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2065
        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
  2066
        self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2067
    ]
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2068
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2069
    "Modified: / 27-07-2012 / 09:41:18 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2070
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2071
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2072
changeFont
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2073
    "pop up a fontPanel to change font"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2074
5676
20a8f1c87323 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5675
diff changeset
  2075
    |newFont fp userPrefs fontPrefs newFontPrefs|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2076
5005
2acadbbf1bce class: TextView
Claus Gittinger <cg@exept.de>
parents: 5004
diff changeset
  2077
    self withWaitCursorDo:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2078
        fp := FontPanel new.
5902
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2079
        newFont := 
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2080
            fp  fontFromUserInitial:gc font 
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2081
                    title:nil
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2082
                    filter:nil
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2083
                    encoding:nil
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2084
                    enabled:true
d0f1e942ec1a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5848
diff changeset
  2085
                    withChangeAllOption:true.
5005
2acadbbf1bce class: TextView
Claus Gittinger <cg@exept.de>
parents: 5004
diff changeset
  2086
    ].
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2087
    newFont notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2088
        self font:newFont.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2089
        fp changeFontInAllViews ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2090
            "/ user checked this box - change the defaults,
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2091
            "/ and update all other textviews now.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2092
            userPrefs := UserPreferences current.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2093
            fontPrefs := userPrefs fontPreferences.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2094
            fontPrefs isNil ifTrue:[ fontPrefs := newFontPrefs := Dictionary new ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2095
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2096
            fontPrefs at:#Text put:(newFont storeString).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2097
            newFontPrefs notNil ifTrue:[ userPrefs fontPreferences:newFontPrefs ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2098
            userPrefs beModified.
5914
1db68d37c59c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  2099
            "/ DebugView newDebugger.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2100
            TextView allSubInstances do:[:v |
5912
68a1083420e5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  2101
                v class defaultFont:newFont.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2102
                v font:newFont
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2103
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2104
        ].
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2105
    ]
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2106
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2107
    "Modified: 27.2.1996 / 00:53:51 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2108
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2109
6202
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2110
compareAgainst:otherText named:whatIsIt
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2111
    "common code for compate with file and compare with clipboard"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2112
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2113
    |myText|
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2114
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2115
    otherText isEmptyOrNil ifTrue:[
6205
4f25a348e0e2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6204
diff changeset
  2116
        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
  2117
        ^ self.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2118
    ].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2119
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2120
    self hasSelection ifTrue:[
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2121
        myText := self selectionAsString.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2122
    ] ifFalse:[
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2123
        myText := self contents asString
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2124
    ].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2125
    myText := myText string.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2126
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2127
    myText = otherText ifTrue:[
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2128
        Dialog information:(resources string:'Strings are equal.').
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2129
        ^ self.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2130
    ].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2131
    DiffTextView
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2132
        openOn:myText label:'Editor'
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2133
        and:otherText label:whatIsIt
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2134
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2135
    "Created: / 01-09-2017 / 14:11:20 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2136
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2137
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2138
compareWithClipboard
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2139
    "compare the selection against the clipboard contents"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2140
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2141
    self compareAgainst:(self getClipboardText) named:'Clipboard'
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2142
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2143
    "Modified: / 01-09-2017 / 14:11:44 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2144
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2145
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2146
compareWithFile
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2147
    "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
  2148
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2149
    |fn fileText|
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2150
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2151
    fn := Dialog requestFileName:(resources string:'Compare against file:') 
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2152
                 default:defaultFileNameForFileDialog.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2153
    fn isEmptyOrNil ifTrue:[^ self].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2154
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2155
    fileText := fn asFilename contentsOfEntireFile.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2156
    self compareAgainst:fileText named:'File'
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2157
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2158
    "Modified: / 01-09-2017 / 14:11:15 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2159
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2160
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2161
copySelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2162
    "copy contents into smalltalk copybuffer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2163
863
ed4282df00a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
  2164
    |text|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2165
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2166
    text := self selection.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2167
    text notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2168
        self unselect.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2169
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2170
        "/ forget any emphasis ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2171
        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
  2172
        self setClipboardText:text.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2173
    ]
649
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  2174
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  2175
    "Modified: 17.5.1996 / 08:57:54 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2176
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2177
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2178
copySelectionBox
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2179
    "copy contents into the smalltalk copybuffer.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2180
     This copies it as a rectangular text area (INed/MAXed-like)"
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2181
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2182
    |text startCol endCol len|
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2183
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2184
    text := self selection.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2185
    text notNil ifTrue:[
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2186
        "/ forget any emphasis ...
6206
f7a386aee648 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6205
diff changeset
  2187
        text := text collect:[:line | line isNil ifTrue:[''] ifFalse:[line string]].
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2188
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2189
        startCol := selectionStartCol.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2190
        endCol := selectionEndCol.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2191
        len := endCol - startCol + 1.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2192
        text := text keysAndValuesCollect:[:idx :line |
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2193
                    
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2194
                    idx == 1 ifTrue:[
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2195
                        (line paddedTo:len) copyTo:len    
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2196
                    ] ifFalse:[
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2197
                        (line paddedTo:startCol+len-1) copyFrom:startCol
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2198
                    ].
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2199
                ].    
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2200
        self unselect.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2201
        self setClipboardText:text.
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2202
    ]
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2203
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2204
    "Created: / 14-03-2017 / 16:06:02 / cg"
6206
f7a386aee648 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6205
diff changeset
  2205
    "Modified (format): / 01-09-2017 / 14:43:07 / cg"
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2206
!
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2207
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2208
defaultForGotoLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2209
    "return a default value to show in the gotoLine box"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2210
447
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2211
    ^ selectionStartLine
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2212
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2213
    "Modified: 1.3.1996 / 18:44:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2214
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2215
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2216
doPrint
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2217
    "print the contents on the printer"
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2218
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2219
    |printStream|
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2220
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2221
    list isNil ifTrue:[^ self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2222
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2223
    self withWaitCursorDo:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2224
        printStream := Printer new.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2225
        printStream supportsContext ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2226
            printStream printerContext font:(self font).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2227
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2228
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2229
        Printer writeErrorSignal handle:[:ex |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2230
            self warn:('error while printing:\\'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2231
                        , ex description
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2232
                        , '\\(printing with: ' , (Printer printCommand) , ')') withCRs
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2233
        ] do:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2234
            self fileOutContentsOn:printStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2235
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2236
        printStream close
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2237
    ].
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  2238
4363
4ed2feefc2c2 changed: #doPrint
Claus Gittinger <cg@exept.de>
parents: 4361
diff changeset
  2239
    "Created: / 06-05-1996 / 16:11:26 / cg"
4ed2feefc2c2 changed: #doPrint
Claus Gittinger <cg@exept.de>
parents: 4361
diff changeset
  2240
    "Modified: / 31-01-2012 / 18:16:39 / cg"
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2241
!
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  2242
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2243
editMenu
1109
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  2244
    "return my popUpMenu"
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  2245
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  2246
    <resource: #keyboard (#Copy #Find #GotoLine #SaveAs #Print)>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  2247
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  2248
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2249
    |item1 items m|
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2250
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2251
    self sensor metaDown ifTrue:[
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2252
        item1 := #(
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2253
                        ('Copy Box'      copySelectionBox  CopyBox)
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2254
                 )        
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2255
    ] ifFalse:[
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2256
        item1 := #(
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2257
                        ('Copy'          copySelection  Copy)
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2258
                 )        
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2259
    ].    
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2260
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2261
    items := item1 , #(
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2262
                        ('-'             nil            )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2263
                        ('Search...'     search         Find)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2264
                        ('Goto Line...'  gotoLine       GotoLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2265
                        ('-'             nil            )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2266
                        ('Font...'       changeFont     )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2267
                        ('-'             nil            )
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2268
                        ('Save As...'    save           SaveAs)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2269
                        ('Print'         doPrint        Print)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2270
                ).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2271
1545
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  2272
    m := PopUpMenu itemList:items resources:resources.
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2273
    
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2274
    self hasSelectionForCopy ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2275
        m disable:#copySelection.
6135
5d74fd984cde #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
  2276
        m disable:#copySelectionBox.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2277
    ].
6146
3cf6c9894f53 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6140
diff changeset
  2278
    m := m asMenu.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2279
    ^ m
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  2280
6146
3cf6c9894f53 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6140
diff changeset
  2281
    "Modified: / 12-04-2017 / 09:06:22 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2282
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2283
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2284
find
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2285
    "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
  2286
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2287
    self search
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2289
    "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
  2290
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2291
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2292
gotoLine
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  2293
    "show a box to enter lineNumber for positioning;
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2294
     The entered number may be prefixed by a + or -;
1926
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  2295
     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
  2296
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2297
    |l lineNumberBox input lineToGo relative peekc|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2298
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2299
    lineNumberBox :=
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2300
        EnterBox
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2301
           title:(resources string:'Line number (or +/- relativeNr):')
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2302
           okText:(resources string:'Goto')
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2303
           abortText:(resources string:'Cancel')
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2304
           action:[:l | input := l readStream].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2305
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2306
    l := self defaultForGotoLine.
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2307
    lineNumberBox initialText:(l ifNotNil:[l printString]).
3394
39086a24097b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
  2308
    lineNumberBox label:(resources string:'Goto Line').
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2309
    lineNumberBox showAtPointer.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2310
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2311
    input isNil ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2312
        ^ self.
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2313
    ].
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2314
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2315
    peekc := input skipSpaces.
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2316
    peekc notNil ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2317
        (peekc == $+) ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2318
            relative := 1.
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2319
        ] ifFalse:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2320
            (peekc == $-) ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2321
                relative := -1.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2322
            ].
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2323
        ].
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2324
        relative notNil ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2325
            input next.
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2326
        ].
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2327
        lineToGo := Integer readFrom:input onError:[^ self].
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2328
        relative notNil ifTrue:[
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2329
            lineToGo := self currentLine + (lineToGo * relative)
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2330
        ].
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2331
        self gotoLine:lineToGo.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2332
    ].
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2333
6140
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2334
    "Modified: / 17-05-1998 / 20:07:59 / cg"
e15bda508e0b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6135
diff changeset
  2335
    "Modified: / 30-03-2017 / 23:05:07 / stefan"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2336
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2337
6202
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2338
openFileBrowserOnFileNamed:fileNameString
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2339
    "open a fileBrowser on the given fileNameString"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2340
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2341
    |fn|
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2342
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2343
    fn := fileNameString asFilename.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2344
    fn exists ifFalse:[
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2345
        fn := fileNameString withoutSeparators withoutQuotes asFilename.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2346
        fn exists ifFalse:[
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2347
            ^ self warn:(resources
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2348
                            string:'Sorry - file "%1" was not found in directory "%2"'
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2349
                            with:fn baseName allBold
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2350
                            with:fn directory baseName allBold).
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2351
        ].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2352
    ].
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2353
    FileBrowser default openOn:fn
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2354
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2355
    "Modified: / 01-09-2017 / 14:03:54 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2356
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2357
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2358
openFileBrowserOnIt
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2359
    "open a fileBrowser on the selected fileName"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2360
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2361
    |fileNameString|
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2362
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2363
    fileNameString := self selectionAsString.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2364
    self openFileBrowserOnFileNamed:fileNameString
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2365
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2366
    "Modified: / 06-09-2012 / 14:47:22 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2367
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2368
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2369
openSaveDialog
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2370
    "Ask user for filename using a fileSelectionBox
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2371
     and save contents into that file."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2372
2695
7e13db2802df better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
  2373
    Dialog
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2374
        requestSaveFileName:(resources string:'Save contents in:')
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2375
        default:defaultFileNameForFileDialog
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2376
        fromDirectory:directoryForFileDialog
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2377
        action:[:fileName | self saveAs:fileName]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2378
        appendAction:[:fileName | self appendTo:fileName]
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2379
!
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2380
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2381
openSearchBoxAndSearch
5736
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2382
    "search for a string - show a box to enter searchpattern.
38cdf9557610 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5735
diff changeset
  2383
     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
  2384
     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
  2385
     would no be appropriate..."
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2386
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2387
    "
4985
414cb5cbe48f class: TextView
Claus Gittinger <cg@exept.de>
parents: 4885
diff changeset
  2388
     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
  2389
     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
  2390
    "
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2391
    |searchBox patternHolder caseHolder matchHolder matchWithRegexHolder wrapAtEndHolder
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2392
     fwd ign match initialString
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2393
     bindings bldr doSearch modal searchVariableHolder selectedVariable searchFullWordHolder selectLinesHolder
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2394
     replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2395
     replaceAllBooleanHolder replacePreserveCaseBooleanHolder
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2396
     searchAtBeginOfLineOnlyHolder updateReturnKeyBehavior|
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2397
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2398
    searchBarActionBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2399
        self resetVariablesBeforeNewSearch.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2400
        searchBarActionBlock value:#search value:self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2401
        ^ self
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2402
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2403
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2404
    modal := (UserPreferences current searchDialogIsModal).   "/ that's experimental
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2405
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2406
    (searchBox := self objectAttributeAt:#currentModelessSearchBox) notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2407
        (modal not
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2408
        and:[ searchBox window realized ]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2409
            "/ reuse it.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2410
            searchBox window
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2411
                raiseDeiconified;
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2412
                requestFocus;
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2413
                assignKeyboardFocusToFirstKeyboardConsumer.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2414
            ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2415
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2416
        searchBox closeRequest.
5734
46a234de32de #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
  2417
    ].
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2418
4864
50303241e6d9 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4804
diff changeset
  2419
    ign := lastSearchIgnoredCase "? LastSearchIgnoredCase " ? true.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2420
    caseHolder := ign not asValue.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2421
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2422
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2423
    matchHolder := match asValue.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2424
    matchWithRegexHolder := (LastSearchWasMatchWithRegex ? false) asValue.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2425
    wrapAtEndHolder := (LastSearchWasWrapAtEndOfText ? false) asValue.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2426
    searchVariableHolder := (lastSearchWasVariableSearch ? false) asValue.
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2427
    searchFullWordHolder := false asValue.
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2428
    searchAtBeginOfLineOnlyHolder := false asValue.
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2429
    selectLinesHolder := false asValue.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2430
    replaceBooleanHolder := ("LastSearchWasReplace ?" false) asValue.
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2431
    replaceAllBooleanHolder := false asValue.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2432
    replacePreserveCaseBooleanHolder := false asValue.
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2433
    replaceTextHolder := (LastSearchReplacedString ? '') asValue.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2434
    replaceBooleanEnabledHolder := self isReadOnly not asValue.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2435
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2436
    patternHolder := '' asValue.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2437
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2438
    self setSearchPatternWithMatchEscapes: match.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2439
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2440
    lastSearchPattern notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2441
        initialString := lastSearchPattern.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2442
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2443
"/  No longer force the current selection to be the initialString
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2444
"/    self hasSelectionWithinSingleLine ifTrue:[
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2445
"/        initialString := self selection asString.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2446
"/    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2447
    initialString isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2448
        LastSearchPatterns size > 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2449
            initialString := LastSearchPatterns first.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2450
        ]
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2451
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2452
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2453
    initialString notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2454
        patternHolder value:initialString.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2455
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2456
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2457
    fwd := true.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2458
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2459
    doSearch := [:fwd |
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2460
        |isVariableSearch pattern searchAction|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2461
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2462
        self resetVariablesBeforeNewSearch.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2463
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2464
        isVariableSearch := self searchVariableVisible
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2465
                                and:[searchVariableHolder value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2466
                                and:[selectedVariable notNil]].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2467
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2468
        isVariableSearch ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2469
            searchAction :=
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2470
                [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2471
                    self searchVariableWithSyntaxElement:selectedVariable forward:fwd
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2472
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2473
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2474
            lastSearchWasVariableSearch := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2475
            LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2476
            LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2477
            LastSearchWasMatchWithRegex := matchWithRegexHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2478
            LastSearchWasWrapAtEndOfText := wrapAtEndHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2479
            LastSearchWasReplace :=replaceBooleanHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2480
            LastSearchReplacedString := replaceTextHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2481
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2482
            pattern := patternHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2483
            pattern notEmptyOrNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2484
                searchAction :=
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2485
                    [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2486
                        self searchUsingSpec:(
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2487
                            self class searchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2488
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2489
                                ignoreCase:lastSearchIgnoredCase
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2490
                                match: lastSearchWasMatch
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2491
                                regexMatch:matchWithRegexHolder value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2492
                                variable: searchVariableHolder value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2493
                                fullWord: searchFullWordHolder value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2494
                                forward:fwd
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2495
                                atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2496
                                wrapAtEnd:wrapAtEndHolder value).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2497
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2498
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2499
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2500
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2501
        replaceBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2502
            |selStart replacement replaceAction|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2503
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2504
            replacement := replaceTextHolder value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2505
            isVariableSearch ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2506
                "/ must replace from the end towards beginning,
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2507
                "/ because syntax-elements do not update their position, when
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2508
                "/ the text is changed (in replace).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2509
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2510
                selectedVariable := selectedVariable lastElementInChain.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2511
                self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2512
                searchAction :=
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2513
                    [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2514
                        selectedVariable := selectedVariable previousElement.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2515
                        selectedVariable notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2516
                            self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2517
                        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2518
                        "/ self searchVariableWithSyntaxElement:selectedVariable forward:false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2519
                    ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2520
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2521
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2522
            replaceAction := [ self replace:replacement ]. "/ not implemented here, but in subclasses
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2523
            replacePreserveCaseBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2524
                replaceAction := [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2525
                    self selectionAsString isUppercaseFirst ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2526
                        self replace:replacement asUppercaseFirst
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2527
                    ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2528
                        self replace:replacement asLowercaseFirst
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2529
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2530
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2531
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2532
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2533
            selStart := self characterPositionOfSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2534
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2535
            replaceAction value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2536
            searchAction value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2537
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2538
            replaceAllBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2539
                [self characterPositionOfSelection ~= selStart] whileTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2540
                    selStart := self characterPositionOfSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2541
                    replaceAction value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2542
                    searchAction value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2543
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2544
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2545
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2546
            searchAction value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2547
        ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2548
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2549
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2550
    bindings := IdentityDictionary new.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2551
    bindings at:#searchPattern put:patternHolder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2552
    modal ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2553
        bindings
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2554
            at:#nextAction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2555
            put:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2556
                replaceAllBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2557
                    searchBox doAccept.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2558
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2559
                    doSearch value:true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2560
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2561
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2562
        bindings
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2563
            at:#prevAction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2564
            put:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2565
                replaceAllBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2566
                    fwd := false. searchBox doAccept.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2567
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2568
                    doSearch value:false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2569
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2570
            ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2571
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2572
        bindings at:#nextAction put:[doSearch value:true.].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2573
        bindings at:#prevAction put:[doSearch value:false.].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2574
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2575
    bindings at:#caseSensitive put:caseHolder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2576
    bindings at:#match put:matchHolder.
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2577
    bindings at:#matchWithRegex put:matchWithRegexHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2578
    Regex::RxMatcher isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2579
        bindings at:#matchWithRegexVisible put:false.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2580
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2581
        bindings at:#matchWithRegexVisible put:matchHolder
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2582
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2583
    bindings at:#patternList put:LastSearchPatterns.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2584
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2585
    self supportsSyntaxElements ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2586
        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
  2587
    ] ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2588
        bindings at:#searchVariableVisible put:true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2589
        selectedVariable := self syntaxElementForSelectedVariable.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2590
        bindings at:#searchVariableEnabled put:(selectedVariable notNil).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2591
        selectedVariable notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2592
            bindings
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2593
                at:#stringWithVariableUnderCursorHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2594
                put:(resources string:'Variable ("%1")' with:selectedVariable name).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2595
            "/ searchVariableHolder value:true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2596
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2597
            bindings
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2598
                at:#stringWithVariableUnderCursorHolder
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2599
                put:(resources string:'Variable (none selected)').
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2600
        ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2601
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2602
    bindings at:#searchVariable put:searchVariableHolder.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2603
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2604
    bindings at:#searchFullWord put:searchFullWordHolder.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2605
    bindings at:#searchFullWordEnabled put:true.
5077
9c8e1b153493 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
  2606
    bindings at:#searchAtBeginOfLineOnly put:searchAtBeginOfLineOnlyHolder.
5547
5637fb125cbf #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
  2607
    bindings at:#wrapAtEndOfTextHolder put:wrapAtEndHolder.
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2608
    bindings at:#selectLinesHolder put:selectLinesHolder.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2609
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2610
    bindings at:#replaceEnabled put:replaceBooleanEnabledHolder.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2611
    bindings at:#replaceBoolean put:replaceBooleanHolder.
5554
f389396b26a6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5547
diff changeset
  2612
    bindings at:#replaceAllBoolean put:replaceAllBooleanHolder.
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2613
    bindings at:#replacePreserveCaseBoolean put:replacePreserveCaseBooleanHolder.
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2614
    bindings at:#replaceTextHolder put:replaceTextHolder.
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2615
5556
0a908345e353 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
  2616
    bindings at:#flyByHelpSpec put:self class flyByHelpSpec.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2617
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2618
    updateReturnKeyBehavior :=
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2619
        [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2620
            |lbl returnAction|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2621
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2622
            "/ when replacing, do not close box on return
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2623
            replaceBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2624
                lbl := 'Close'.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2625
                returnAction := searchAction.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2626
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2627
                lbl := 'Cancel'.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2628
                returnAction := nil.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2629
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2630
            (bldr componentAt:#cancelButton) label:(resources string:lbl).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2631
            searchBox window keyboardProcessor returnAction:returnAction.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2632
        ].
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2633
5010
ad4a10879e16 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5005
diff changeset
  2634
    replaceBooleanHolder onChangeEvaluate:
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2635
        [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2636
            replaceBooleanHolder value ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2637
                (bldr componentAt:#ReplaceEntryField) requestFocus
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2638
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2639
                (bldr componentAt:#patternComboBox) requestFocus
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2640
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2641
            updateReturnKeyBehavior value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2642
        ].
5555
7390d495b02c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2643
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2644
    modal ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2645
        searchBox := SimpleDialog new.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2646
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2647
        searchBox := ApplicationModel new.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2648
        searchBox createBuilder.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2649
        bindings at:#cancel put:[ searchBox closeRequest ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2650
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2651
    searchBox resources:(self resources).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2652
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2653
    bldr := searchBox builder.
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2654
    bldr addBindings:bindings.
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2655
    bldr aspectAt:#flyByHelpSpec put:(self class flyByHelpSpec).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2656
    searchBox allButOpenFrom:(self class searchDialogSpec).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2657
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2658
    (bldr componentAt:#nextButton) cursor:(Cursor thumbsUp).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2659
    (bldr componentAt:#prevButton) cursor:(Cursor thumbsUp).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2660
    (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2661
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2662
    modal ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2663
        updateReturnKeyBehavior value.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2664
        searchBox openDialogAtPointer.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2665
        searchBox accepted ifTrue:[ doSearch value:fwd ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2666
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2667
        (bldr componentAt:#nextButton) isReturnButton:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2668
        (bldr componentAt:#cancelButton)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2669
                label:(resources string:'Close');
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2670
                action:[searchBox closeRequest].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2671
        "/ searchBox masterApplication:self application.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2672
        self topView beMaster.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2673
        searchBox window
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2674
                beSlave;
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2675
                openInGroup:(self windowGroup);
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2676
                waitUntilVisible;
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2677
                assignKeyboardFocusToFirstKeyboardConsumer.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2678
        searchBox window keyboardProcessor
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2679
            addAccelerator:#Return action:(bindings at:#nextAction);
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2680
            addAccelerator:#Escape action:#closeRequest.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2681
        "/ remember this box for me.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2682
        self objectAttributeAt:#currentModelessSearchBox put:searchBox.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2683
    ]
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2684
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2685
    "Modified: / 11-07-2006 / 11:18:38 / fm"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2686
    "Created: / 08-03-2012 / 14:02:59 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2687
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2688
6202
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2689
openWorkspaceWithIt
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2690
    "open a workspace containing the selected text"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2691
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2692
    |text|
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2693
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2694
    text := self selectionAsString.
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2695
    WorkspaceApplication openWith:text selected:true
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2696
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2697
    "Created: / 26-05-2007 / 06:05:22 / cg"
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2698
!
3b9b166e5fc1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
  2699
5757
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2700
replace:someText
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2701
    "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
  2702
     Subclasses may redefine me."
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2703
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2704
    ^ self.
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2705
!
6b9528edde06 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5741
diff changeset
  2706
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2707
save
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2708
    "save contents into a file
2836
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2709
     - ask user for filename using a fileSelectionBox."
de07d386cfe8 allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2710
3201
ce84e272c6bb code cleanup
Claus Gittinger <cg@exept.de>
parents: 3189
diff changeset
  2711
    saveAction value
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2712
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2713
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2714
saveAs:fileName
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2715
    "save the contents into a file named fileName.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2716
     On error return false otherwise return true"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2717
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2718
    ^ self saveAs:fileName doAppend:false
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2719
!
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2720
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2721
saveAs:aFilename doAppend:doAppend
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  2722
    "save the contents into a file named fileName;
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2723
     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
  2724
     contents - otherwise, it overwrites any previous file contents.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2725
     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
  2726
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2727
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:true
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2728
!
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2729
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2730
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2731
    "save the contents into a file named fileName;
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2732
     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
  2733
     contents - otherwise, it overwrites any previous file contents.
5113
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2734
     On error return false otherwise return true"
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2735
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2736
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:nil
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2737
!
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2738
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2739
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:eolMode
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2740
    "save the contents into a file named fileName;
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2741
     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
  2742
     contents - otherwise, it overwrites any previous file contents.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2743
     eolMode is one of #cr, #nl or #crlf.
d5f95ba1494b class: TextView
Claus Gittinger <cg@exept.de>
parents: 5099
diff changeset
  2744
     On error return false otherwise return true."
4534
bfd6c9687185 TextView
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  2745
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2746
    |filename msg|
2701
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2747
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2748
    filename := aFilename asFilename.
b77cc7cf3818 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 2695
diff changeset
  2749
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2750
    self withWriteCursorDo:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2751
        |aStream|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2752
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2753
        (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2754
            msg := resources
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2755
                        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
  2756
                        with:filename name.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2757
        ] ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2758
            [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2759
                doAppend ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2760
                    aStream := filename appendingWriteStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2761
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2762
                    UserPreferences current generateBackupFileWhenSaving ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2763
                        filename exists ifTrue:[
6084
495039449826 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6059
diff changeset
  2764
                            filename moveTo:filename asBackupFilename.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2765
                        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2766
                    ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2767
                    aStream := filename newReadWriteStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2768
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2769
                aStream eolMode:eolMode.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2770
                self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2771
                aStream syncData; close.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2772
                contentsWasSaved := true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2773
                defaultFileNameForFileDialog := filename.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2774
            ] on:FileStream openErrorSignal do:[:ex|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2775
                msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2776
                                with:filename name
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2777
                                with:FileStream lastErrorString.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2778
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2779
        ].
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2780
    ].
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2781
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2782
    msg notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2783
        Dialog warn:msg.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2784
        ^ false
3426
bbcad86d26a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
  2785
    ].
2834
be970a6f9333 return true for successful save
penk
parents: 2822
diff changeset
  2786
    ^ true
916
4201c9c2a4f0 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  2787
4437
561731a3d484 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2788
    "Modified: / 27-07-2012 / 09:45:13 / cg"
6084
495039449826 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6059
diff changeset
  2789
    "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
  2790
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2791
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  2792
search
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2793
    "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
  2794
     - 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
  2795
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2796
    self openSearchBoxAndSearch
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2797
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2798
    "Modified: / 11-07-2006 / 11:18:38 / fm"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2799
    "Modified: / 08-03-2012 / 14:03:10 / cg"
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2800
!
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2801
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2802
search:patternArg ignoreCase:ign forward:fwd
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2803
    "search for a string without matching"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2804
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2805
    self search:patternArg ignoreCase:ign match: false forward:fwd
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2806
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  2807
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2808
search:patternArg ignoreCase:ign match: match forward:fwd
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2809
    |pattern|
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2810
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2811
    pattern := patternArg string.
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2812
    pattern notEmpty ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2813
        self rememberSearchPattern:pattern.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2814
        "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2815
        "/ LastSearchWasMatch := match.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2816
        fwd ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2817
            lastSearchDirection := #backward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2818
            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
  2819
        ] ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2820
            lastSearchDirection := #forward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2821
            self searchFwd:pattern ignoreCase:ign match: match.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2822
        ]
3318
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2823
    ]
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2824
ebd115677fd5 felix' search refactoring
fm
parents: 3316
diff changeset
  2825
    "Created: / 11-07-2006 / 11:18:04 / fm"
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  2826
    "Modified: / 23-03-2012 / 12:12:07 / cg"
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2827
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2828
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2829
searchUsingSpec:aSearchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2830
    self rememberSearchPattern:(aSearchSpec pattern).
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2831
    "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2832
    "/ LastSearchWasMatch := match.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2833
    aSearchSpec forward ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2834
        lastSearchDirection := #backward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2835
        self searchBwdUsingSpec:aSearchSpec
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2836
    ] ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2837
        lastSearchDirection := #forward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2838
        self searchFwdUsingSpec:aSearchSpec
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2839
    ]
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2840
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2841
    "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
  2842
    "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
  2843
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  2844
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2845
searchVariableVisible
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2846
    "search variable option in searchbox visible?
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2847
     (only true for codeview2's textview)"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2848
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2849
    ^ false
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2850
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2851
    "Created: / 08-03-2012 / 14:01:24 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2852
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2853
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2854
searchVariableWithSyntaxElement:syntaxElementForVariable forward:fwd
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2855
    "this only works for CodeView2::TextView, which supports syntaxElements.
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  2856
     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
  2857
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  2858
    |el el2|
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
    lastSearchWasVariableSearch := true.
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2861
    el := fwd
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2862
        ifTrue:[syntaxElementForVariable nextElement]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2863
        ifFalse:[syntaxElementForVariable previousElement].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2864
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2865
    el notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2866
        "bug workaround"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2867
        (el start = syntaxElementForVariable start) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2868
            el2 := fwd
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2869
                ifTrue:[el nextElement]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2870
                ifFalse:[el previousElement].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2871
            el2 notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2872
                el := el2
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2873
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2874
        ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2875
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2876
    el notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2877
        self selectFromCharacterPosition:el start to:el stop.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2878
        self makeLineVisible:(self lineOfCharacterPosition:el start).
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2879
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2880
        self showNotFound
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2881
    ].
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2882
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2883
    "Created: / 08-03-2012 / 14:08:20 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2884
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2885
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2886
syntaxElementForSelectedVariable
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2887
    "for a better search; ignored here, but redefined in CodeView2"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2888
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2889
    ^ nil
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2890
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2891
    "Created: / 08-03-2012 / 14:20:27 / cg"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2892
!
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2893
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2894
syntaxElementForVariableUnderCursor
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2895
    "for a better search; ignored here, but redefined in CodeView2"
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2896
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2897
    ^ nil
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2898
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  2899
    "Created: / 08-03-2012 / 12:45:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2900
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2901
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2902
!TextView methodsFor:'native widget support'!
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2903
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2904
nativeWindowType
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  2905
    "return a symbol describing my native window type
5543
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2906
     (may be used internally by the device as a native window creation hint,
39eb7c59b271 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  2907
      if the device supports native windows)"
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2908
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2909
    ^ #TextView
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2910
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2911
    "Created: 2.5.1997 / 14:41:00 / cg"
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2912
! !
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  2913
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2914
!TextView methodsFor:'private'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2915
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2916
currentSelectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2917
    ^  selectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2918
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2919
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2920
currentSelectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2921
    ^ selectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2922
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2923
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2924
fileOutContentsOn:aStream
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2925
    "save contents on a stream, replacing leading spaces by tab-characters."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2926
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2927
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2928
        fileOutContentsOn:aStream
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2929
        compressTabs:true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2930
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2931
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2932
fileOutContentsOn:aStream compressTabs:compressTabs
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2933
    "save contents on a stream. If compressTabs is true,
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2934
     leading spaces will be replaced by tab-characters in the output."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2935
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  2936
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2937
        fileOutContentsOn:aStream
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2938
        compressTabs:compressTabs
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2939
        encoding:nil
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2940
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2941
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2942
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
  2943
    "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
  2944
     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
  2945
2877
cdaea8ccd364 encoding
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  2946
    |startNr nLines string encoder|
cdaea8ccd364 encoding
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  2947
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2948
    self removeTrailingWhitespace.
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  2949
5658
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  2950
    "/ This is now obsolete, as we are always using unicode internally.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  2951
    "/ 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
  2952
    encoder := CharacterEncoder encoderToEncodeFrom:gc characterEncoding into:encodingSymOrNil.
4455
febe97112d50 changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  2953
    encoder isNullEncoder ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2954
        (list contains:[:lineOrNil|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2955
                            |s|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2956
                            lineOrNil notNil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2957
                            and:[(s := lineOrNil string string) isWideString
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2958
                            and:[s asSingleByteStringIfPossible isWideString]]
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
        ) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2961
            (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
  2962
                ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2963
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2964
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2965
        encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8
4455
febe97112d50 changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  2966
    ].
2916
7f1e089959a3 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  2967
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2968
    aStream isFileStream ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2969
        "on some systems, writing linewise is very slow (via NFS)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2970
         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
  2971
         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
  2972
         limiting temporary string creation to about 50-80k.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2973
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2974
        startNr := 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2975
        nLines := list size.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2976
        (aStream eolMode notNil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2977
        and:[aStream eolMode ~= #nl]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2978
            "/ must do it lineWise ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2979
            list do:[:line |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2980
                line notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2981
                    encoder encodeString:line withTabs on:aStream
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2982
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2983
                aStream cr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2984
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2985
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2986
            [startNr <= nLines] whileTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2987
                string := list
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2988
                            asStringWithCRsFrom:startNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2989
                            to:((startNr + 1000) min:nLines)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2990
                            compressTabs:compressTabs.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2991
                encoder encodeString:string string on:aStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2992
                startNr := startNr + 1000 + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2993
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2994
        ].
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  2995
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2996
        list do:[:aLine |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2997
            aLine notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2998
                encoder encodeString:aLine on:aStream.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2999
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3000
            aStream cr.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3001
        ]
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  3002
    ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3003
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  3004
    "Modified: 8.6.1996 / 11:50:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3005
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3006
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  3007
getFontParameters
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  3008
    "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
  3009
     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
  3010
     line separation. This is required, to allow for proper handling of
4779
9f7633fc5583 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4767
diff changeset
  3011
     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
  3012
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3013
    |italicFont boldFont font|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3014
5820
7dafda8e0ce8 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5791
diff changeset
  3015
    font := gc deviceFont.
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3016
    "/ do we really need this info now?
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3017
    "/ on unix, it seems to work with the next two lines commented;
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3018
    "/ 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
  3019
    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
  3020
    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
  3021
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3022
    fontHeight := font height.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3023
    fontAscent := font ascent.
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3024
    fontWidth := font width.
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3025
    fontIsFixedWidth := font isFixedWidth.
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3026
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3027
    "/ fA := font maxAscent.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3028
    italicFont notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3029
        fontHeight := fontHeight max:(italicFont height).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3030
        fontAscent := fontAscent max:(italicFont ascent).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3031
        fontIsFixedWidth := fontIsFixedWidth and:[ italicFont isFixedWidth ]
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3032
    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3033
    boldFont notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3034
        fontHeight := fontHeight max:(boldFont height).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3035
        fontAscent := fontAscent max:(boldFont ascent).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3036
        fontIsFixedWidth := fontIsFixedWidth and:[ boldFont isFixedWidth ]
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  3037
    ].
5443
61ebc1660709 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5412
diff changeset
  3038
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  3039
    includesNonStrings == true ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3040
        "/ for now, we do not support variable height entries ...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3041
        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
  3042
    ].
4579
3a5a72358a0a class: TextView
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
  3043
    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
  3044
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  3045
    "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
  3046
    "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
  3047
!
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  3048
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3049
highlightLineSpacing
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3050
    "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
  3051
     false if it remains white.
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3052
     false for selection in list views; true for edit/text views"
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3053
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3054
    ^ true
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3055
!
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  3056
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3057
isClosingParenthesis:ch
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3058
    ((parenthesisSpecification at:#close) includes:ch) ifTrue:[^ true].
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3059
    ^ ')]}' includes:ch
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3060
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3061
    "Modified: / 12-02-2012 / 08:37:01 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3062
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3063
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3064
isOpeningParenthesis:ch
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3065
    ((parenthesisSpecification at:#open) includes:ch) ifTrue:[^ true].
4368
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3066
    ^ '([{' includes:ch
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3067
23ab3a7cf707 changed:
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  3068
    "Modified: / 12-02-2012 / 08:37:11 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3069
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  3070
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3071
rememberSearchPattern:pattern
2691
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  3072
    |nRemembered patternString|
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  3073
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3074
    self clearSearchAction.
2813
ec8e83691849 forget searchAction, when a new pattern-search is done
Claus Gittinger <cg@exept.de>
parents: 2811
diff changeset
  3075
2691
2c4350e0bcf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  3076
    patternString := pattern string.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3077
3270
e3ed37e15f9d oops - last-searchpatterns handling removed the wrong one.
Claus Gittinger <cg@exept.de>
parents: 3258
diff changeset
  3078
    nRemembered := NumRememberedSearchPatterns ? 20.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3079
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3080
    LastSearchPatterns isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3081
        LastSearchPatterns := OrderedCollection new.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3082
    ].
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3083
    "/ move to top or addFirst
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  3084
    (LastSearchPatterns includes:patternString) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3085
        LastSearchPatterns remove:patternString.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3086
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3087
        LastSearchPatterns size > nRemembered ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3088
            LastSearchPatterns removeLast
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3089
        ]
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3090
    ].
4409
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  3091
    LastSearchPatterns addFirst:patternString.
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  3092
37712dd0d074 variable searching
Claus Gittinger <cg@exept.de>
parents: 4408
diff changeset
  3093
    "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
  3094
!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  3095
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3096
removeTrailingWhitespace
3001
d9877eeb59f5 *** empty log message ***
ca
parents: 2992
diff changeset
  3097
    list isNil ifTrue:[^self].
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3098
    list keysAndValuesDo:[:lineNR :line |
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3099
        |l|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3100
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3101
        line notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3102
            l := line withoutTrailingSeparators.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3103
            list at:lineNR put:l.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3104
        ]
2945
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3105
    ].
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3106
!
5c4f000c7f17 remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents: 2944
diff changeset
  3107
4009
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3108
resetVariablesBeforeNewSearch
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3109
    "clear the autosearch action, when the first pattern is searched for"
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3110
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3111
    searchAction := nil.
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3112
!
6c421dbb325e added: #resetVariablesBeforeNewSearch
fm
parents: 4008
diff changeset
  3113
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3114
scrollSelectDown
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3115
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3116
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3117
    |prevEndLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3118
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3119
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3120
    selectionEndLine isNil ifTrue:[^ self].
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
    self scrollDown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3123
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3124
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3125
    prevEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3126
    selectionEndLine := firstLineShown + nFullLinesShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3127
    selectionEndCol := 0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3128
    prevEndLine to:selectionEndLine do:[:lineNr |
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3129
        self redrawLine:lineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3130
    ].
5235
888c50995301 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5120
diff changeset
  3131
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  3132
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3133
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3134
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3135
scrollSelectLeft
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3136
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3137
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3138
    |prevStartLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3139
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3140
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3141
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3142
    selectionStartCol isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3143
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3144
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3145
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3146
    selectionStartCol := selectionStartCol - 1 max:1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3147
    self scrollLeft.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3148
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3149
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  3150
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3151
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3152
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3153
scrollSelectRight
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3154
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3155
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3156
    |prevEndCol firstVisibleCol endLine|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3157
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3158
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3159
    selectionEndCol isNil ifTrue:[^ self].
4169
11d3b7a3e713 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4160
diff changeset
  3160
    selectionEndLine isNil ifTrue:[^ self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3161
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3162
    prevEndCol := selectionEndCol.
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3163
    selectionEndCol := (selectionEndCol + 1) min:(self listAt:selectionEndLine) size.
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3164
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3165
    endLine := self listLineToVisibleLine:selectionEndLine.
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3166
    endLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3167
        firstVisibleCol := self colOfX:1 inVisibleLine:endLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3168
        selectionEndCol < firstVisibleCol ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3169
            "/ scrolling faster than selection advances...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3170
            selectionEndCol := firstVisibleCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3171
        ].
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3172
    ].
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3173
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3174
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3175
    self scrollRight.
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3176
    "/ self repairDamage.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3177
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3178
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4156
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3179
df8875264273 changed: #scrollSelectRight
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  3180
    "Modified: / 05-08-2010 / 21:25:56 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3181
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3182
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3183
scrollSelectUp
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3184
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3185
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3186
    |prevStartLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3187
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3188
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3189
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3190
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3191
    self scrollUp.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3192
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3193
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3194
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3195
    selectionStartLine := firstLineShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3196
    selectionStartCol := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3197
    selectionStartLine to:prevStartLine do:[:lineNr |
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3198
        self redrawLine:lineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3199
    ].
5236
43100a0d8a8a class: TextView
Claus Gittinger <cg@exept.de>
parents: 5235
diff changeset
  3200
    autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  3201
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3202
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3203
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3204
stopScrollSelect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3205
    "stop auto scroll; deinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3206
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3207
    autoScrollBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3208
        Processor removeTimedBlock:autoScrollBlock.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3209
        self compressMotionEvents:true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3210
        autoScrollBlock := nil.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3211
        autoScrollDeltaT := nil
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3212
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3213
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3214
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3215
textChanged
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3216
    self isNativeWidget ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3217
        gc drawableId notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3218
            device changeText:self contents in:gc drawableId
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3219
        ]
5120
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3220
    ].
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3221
    super textChanged
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3222
!
a5fd21e1f0b0 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5113
diff changeset
  3223
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3224
widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3225
    "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
  3226
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3227
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3228
        "/ if there is a selection which covers multiple lines,
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3229
        "/ 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
  3230
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3231
        (lastLine < selectionStartLine) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3232
            (firstLine > selectionEndLine) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3233
                ^ width
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3234
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3235
        ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3236
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3237
    ^ super widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3238
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3239
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3240
!TextView methodsFor:'queries'!
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3241
4063
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3242
hasSearchActionSelection
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3243
    "Here we fake the use of typeOfSelection which is really in EditTextView"
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3244
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3245
    ^ false
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3246
!
6d2caa13cb14 added: #hasSearchActionSelection
fm
parents: 4056
diff changeset
  3247
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3248
specClass
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  3249
    "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
  3250
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3251
    self class == TextView ifTrue:[^ TextEditorSpec].
1046
10da5b6bd390 specClass query
ca
parents: 1028
diff changeset
  3252
    ^ super specClass
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3253
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  3254
    "Modified: / 31.10.1997 / 19:48:35 / cg"
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3255
! !
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  3256
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3257
!TextView methodsFor:'redrawing'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3258
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3259
clearMarginOfVisibleLine:visLine with:color
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3260
    "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
  3261
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3262
    (leftMargin ~~ 0) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3263
        viewOrigin x <= margin ifTrue:[
6059
862a2c65691b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5955
diff changeset
  3264
            gc paint:color.
862a2c65691b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5955
diff changeset
  3265
            gc fillRectangleX:(margin-viewOrigin) x y:(self yOfVisibleLine:visLine)- (lineSpacing//2)
862a2c65691b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5955
diff changeset
  3266
               width:leftMargin height:fontHeight
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3267
        ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3268
    ]
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3269
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3270
    "Created: 6.3.1996 / 14:22:55 / cg"
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3271
!
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3272
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3273
drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3274
    startVisLineNr to:endVisLineNr do:[:visLine |
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3275
        self drawVisibleLineSelected:visLine
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3276
    ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3277
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3278
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3279
drawVisibleLineSelected:visLineNr
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3280
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3281
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3282
        inVisible:visLineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3283
        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
  3284
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3285
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3286
drawVisibleLineSelected:visLineNr col:col
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3287
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3288
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3289
        inVisible:visLineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3290
        col:col
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3291
        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
  3292
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3293
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3294
drawVisibleLineSelected:visLineNr from:selectionStartCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3295
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3296
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3297
        inVisible:visLineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3298
        from:selectionStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3299
        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
  3300
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3301
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3302
drawVisibleLineSelected:visLineNr from:startCol to:endCol
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3303
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3304
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3305
        inVisible:visLineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3306
        from:startCol to:endCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3307
        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
  3308
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3309
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3310
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3311
    "redraw a visible line range"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3312
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3313
    |startLine endLine specialCare end selVisStart line1 line2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3314
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3315
    shown ifFalse:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3316
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3317
    end := endVisLineNr.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3318
    (end > nLinesShown) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3319
        end := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3320
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3321
2740
892dfb6b0da1 kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  3322
    selectionEndLine isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3323
        selectionStartLine := nil
2740
892dfb6b0da1 kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  3324
    ].
2735
5ba2010aefa4 *** empty log message ***
penk
parents: 2730
diff changeset
  3325
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3326
    selectionStartLine isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3327
        specialCare := false
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3328
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3329
        startLine := self visibleLineToAbsoluteLine:startVisLineNr.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3330
        (startLine > selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3331
            specialCare := false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3332
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3333
            endLine := self visibleLineToAbsoluteLine:end.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3334
            (endLine < selectionStartLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3335
                specialCare := false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3336
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3337
                specialCare := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3338
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3339
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3340
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3341
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3342
    "easy: nothing is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3343
    specialCare ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3344
        super redrawFromVisibleLine:startVisLineNr to:end.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3345
        ^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3346
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3347
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3348
    "easy: all is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3349
    ((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3350
        self drawSelectedFromVisibleLine:startVisLineNr to:end.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3351
        ^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3352
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3353
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3354
    (selectionStartLine >= firstLineShown) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3355
        "draw unselected top part"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3356
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3357
        selVisStart := self listLineToVisibleLine:selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3358
        super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3359
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3360
        "and first partial selected line"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3361
        self redrawVisibleLine:selVisStart.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3362
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3363
        "rest starts after this one"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3364
        line1 := selVisStart + 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3365
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3366
        line1 := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3367
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3368
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3369
    (line1 > end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3370
    (line1 < startVisLineNr) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3371
        line1 := startVisLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3372
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3373
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3374
    "draw middle part of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3375
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3376
    (selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3377
        line2 := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3378
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3379
        line2 := (self listLineToVisibleLine:selectionEndLine) - 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3380
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3381
    (line2 > end) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3382
        line2 := end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3383
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3384
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3385
    self drawSelectedFromVisibleLine:line1 to:line2.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3386
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3387
    (line2 >= end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3388
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3389
    "last line of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3390
    self redrawVisibleLine:(line2 + 1).
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
    ((line2 + 2) <= end) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3393
        super redrawFromVisibleLine:(line2 + 2) to:end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3394
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3395
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3396
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3397
redrawVisibleLine:visLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3398
    "redraw visible line lineNr"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3399
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3400
    |line|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3401
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3402
    (selectionStartLine notNil and:[selectionEndLine notNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3403
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3404
        line := self visibleLineToAbsoluteLine:visLineNr.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3405
        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3406
            (line == selectionStartLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3407
                (line == selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3408
                    "it's part-of-single-line selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3409
                    self clearMarginOfVisibleLine:visLineNr with:bgColor.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3410
                    (selectionStartCol > 1) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3411
                        super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3412
                    ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3413
                    self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3414
                    super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3415
                    ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3416
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3417
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3418
                "it's the first line of a multi-line selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3419
                (selectionStartCol ~~ 1) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3420
                    self clearMarginOfVisibleLine:visLineNr with:bgColor.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3421
                    super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3422
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3423
                    viewOrigin x == 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3424
                        self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3425
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3426
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3427
                self drawVisibleLineSelected:visLineNr from:selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3428
                ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3429
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3430
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3431
            (line == selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3432
                "it's the last line of a multi-line selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3433
                (selectionEndCol == 0) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3434
                    ^ super redrawVisibleLine:visLineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3435
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3436
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3437
                self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3438
                self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3439
                super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3440
                ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3441
            ].
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
            "it's a full line in a multi-line selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3444
            self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3445
            self drawVisibleLineSelected:visLineNr.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3446
            ^ self
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
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3449
    super redrawVisibleLine:visLineNr
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3450
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3451
    "Modified: 6.3.1996 / 14:22:19 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3452
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3453
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3454
redrawVisibleLine:visLine col:col
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3455
    "redraw single character at col in visible line lineNr."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3456
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3457
    |line|
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3458
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3459
    "/
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3460
    "/ care for selection
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  3461
    "/
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3462
    (selectionStartLine notNil and:[selectionEndLine notNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3463
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3464
        line := self visibleLineToAbsoluteLine:visLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3465
        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3466
            ((line == selectionStartLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3467
            and: [col < selectionStartCol]) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3468
                ((line == selectionEndLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3469
                and: [col > selectionEndCol]) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3470
                    "its in the selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3471
                    self drawVisibleLineSelected:visLine col:col.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3472
                    ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3473
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3474
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3475
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3476
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  3477
    self drawVisibleLine:visLine col:col with:fgColor and:bgColor
1496
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3478
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3479
    "Modified: / 22.4.1998 / 08:53:05 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3480
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3481
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3482
redrawVisibleLine:visLine from:startCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3483
    "redraw visible line lineNr from startCol to end of line"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3484
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3485
    |col line|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3486
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3487
    col := startCol.
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3488
    col == 0 ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3489
        col := 1.
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3490
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3491
2778
223915a2d6a4 kludge workaround selectionEndLine is sometimes nil
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  3492
    (selectionStartLine notNil and:[selectionEndLine notNil]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3493
        line := self visibleLineToAbsoluteLine:visLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3494
        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3495
            ((line == selectionStartLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3496
             or:[line == selectionEndLine]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3497
                "since I'm lazy, redraw full line"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3498
                self redrawVisibleLine:visLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3499
                ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3500
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3501
            "the line is fully within the selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3502
            self drawVisibleLineSelected:visLine from:col.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3503
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3504
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3505
    ].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3506
    super redrawVisibleLine:visLine from:col
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3507
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3508
    "Modified: 6.3.1996 / 14:19:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3509
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3510
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3511
redrawVisibleLine:visLine from:startCol to:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3512
    "redraw visible line lineNr from startCol to endCol"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3513
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3514
    |line allOut allIn leftCol rightCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3515
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3516
    line := self visibleLineToAbsoluteLine:visLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3517
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3518
    allIn := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3519
    allOut := false.
4528
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3520
    (selectionStartLine isNil or:[selectionEndLine isNil
527c90bfd2cc class: TextView
Claus Gittinger <cg@exept.de>
parents: 4500
diff changeset
  3521
    or:[selectionStartCol isNil or:[selectionEndCol isNil]]]) ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3522
        allOut := true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3523
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3524
        (line between:selectionStartLine and:selectionEndLine) ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3525
            allOut := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3526
        ] ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3527
            (selectionStartLine == selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3528
                ((endCol < selectionStartCol)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3529
                or:[startCol > selectionEndCol]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3530
                    allOut := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3531
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3532
                    ((startCol >= selectionStartCol)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3533
                    and:[endCol <= selectionEndCol]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3534
                        allIn := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3535
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3536
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3537
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3538
                (line == selectionStartLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3539
                    (endCol < selectionStartCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3540
                        allOut := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3541
                    ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3542
                        (startCol >= selectionStartCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3543
                            allIn := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3544
                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3545
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3546
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3547
                    (line == selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3548
                        (startCol > selectionEndCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3549
                            allOut := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3550
                        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3551
                            (endCol <= selectionEndCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3552
                                allIn := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3553
                            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3554
                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3555
                    ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3556
                        allIn := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3557
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3558
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3559
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3560
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3561
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3562
    allOut ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3563
        super redrawVisibleLine:visLine from:startCol to:endCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3564
        ^ self
248
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3567
    allIn ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3568
        self drawVisibleLineSelected:visLine from:startCol to:endCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3569
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3570
        "redraw part before selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3571
        ((line == selectionStartLine)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3572
         and:[startCol <= selectionStartCol]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3573
            super redrawVisibleLine:visLine from:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3574
                                              to:(selectionStartCol - 1).
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3575
            leftCol := selectionStartCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3576
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3577
            leftCol := startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3578
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3579
        "redraw selected part"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3580
        (selectionEndLine > line) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3581
            rightCol := endCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3582
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3583
            rightCol := selectionEndCol min:endCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3584
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3585
        self drawVisibleLineSelected:visLine from:leftCol to:rightCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3586
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3587
        "redraw part after selection"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3588
        (rightCol < endCol) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3589
            super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3590
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3591
    ].
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
    "special care for first and last line of selection:
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3594
     must handle margin also"
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
    ((line == selectionEndLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3597
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3598
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3599
    ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3600
        self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3601
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3602
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3603
    ((line == selectionStartLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3604
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3605
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3606
    ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3607
        self clearMarginOfVisibleLine:visLine with:bgColor.
4602
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3608
    ].
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3609
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3610
    ((line > selectionStartLine)
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3611
    and:[(startCol == 1)
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3612
    and:[selectionStartLine < selectionEndLine
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3613
    and:[line < selectionEndLine]]])
e487576b81a7 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  3614
    ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3615
        self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3616
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3617
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3618
    "Modified: 6.3.1996 / 14:23:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3619
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3620
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3621
!TextView methodsFor:'searching'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3622
2814
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3623
clearSearchAction
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3624
    searchAction := nil.
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3625
!
881a1a20eace clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3626
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3627
scanFor:aCharacter fromLine:startLine col:startCol forward:forward
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3628
                     ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3629
                  ifNotFound:notFoundBlock
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3630
    "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
  3631
     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
  3632
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3633
    |lineString
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3634
     line   "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3635
     col    "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3636
     delta  "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3637
     endCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3638
     cc
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3639
     maxLine "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3640
      |
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3641
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3642
    col := startCol.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3643
    line := startLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3644
    forward ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3645
        delta := 1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3646
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3647
        delta := -1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3648
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3649
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3650
    lineString := list at:line.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3651
    maxLine := list size.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3652
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3653
    col := col + delta.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3654
    [true] whileTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3655
        lineString notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3656
            forward ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3657
                endCol := lineString size.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3658
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3659
                endCol := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3660
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3661
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3662
            col to:endCol by:delta do:[:rCol |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3663
                cc := lineString at:rCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3664
                cc == aCharacter ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3665
                    ^ foundBlock value:line value:rCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3666
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3667
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3668
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3669
        line := line + delta.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3670
        (line < 1 or:[line > maxLine]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3671
            ^ notFoundBlock value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3672
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3673
        lineString := list at:line.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3674
        forward ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3675
            col := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3676
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3677
            col := lineString size
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3678
        ]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3679
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3680
    "not reached"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3681
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3682
    "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
  3683
    "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
  3684
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  3685
3802
sr
parents: 3792
diff changeset
  3686
searchAction
sr
parents: 3792
diff changeset
  3687
    ^ searchAction
sr
parents: 3792
diff changeset
  3688
!
sr
parents: 3792
diff changeset
  3689
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3690
searchAction:aSearcherOrSearchBlock
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3691
    searchAction := aSearcherOrSearchBlock
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3692
!
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3693
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3694
searchAgainInSameDirection
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3695
    "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
  3696
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3697
    |ign match|
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3698
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  3699
    searchBarActionBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3700
        searchBarActionBlock value:#forward value:self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3701
        ^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3702
    ].
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3703
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3704
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3705
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3706
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3707
    self setSearchPatternWithMatchEscapes: match.
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3708
    lastSearchPattern notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3709
        lastSearchDirection == #backward ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3710
            self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3711
                searchBwd:lastSearchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3712
                ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3713
                match: match
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3714
        ] ifFalse:[
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
                searchFwd:lastSearchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3717
                ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3718
                match: match
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3719
        ]
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3720
    ]
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3721
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3722
    "Created: / 03-05-1999 / 15:02:16 / cg"
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3723
    "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
  3724
!
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  3725
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3726
searchBwd
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3727
    "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
  3728
     If found, position cursor"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3729
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3730
    |ign selectedVariable|
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  3731
2811
3a7aed97fd76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  3732
    searchAction notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3733
        "/autosearch is cleared whenever there is search with user selection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3734
        (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
4178
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3735
    ].
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3736
db73b9c9a3f4 changed: #searchBwd
Claus Gittinger <cg@exept.de>
parents: 4177
diff changeset
  3737
    searchAction notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3738
        "/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
  3739
        self searchUsingSearchAction:#backward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3740
        ^ self.
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3741
    ].
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  3742
    searchBarActionBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3743
        searchBarActionBlock value:#backward value:self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3744
        ^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  3745
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3746
    lastSearchWasVariableSearch ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3747
        selectedVariable := self syntaxElementForSelectedVariable.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3748
        selectedVariable notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3749
            self searchVariableWithSyntaxElement:selectedVariable forward:false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3750
            ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3751
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3752
        lastSearchWasVariableSearch := false.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3753
    ].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  3754
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3755
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  3756
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3757
    self setSearchPatternWithMatchEscapes: false.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3758
    lastSearchPattern isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3759
        LastSearchPatterns size > 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3760
            lastSearchPattern := LastSearchPatterns first
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3761
        ]
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3762
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  3763
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3764
    lastSearchPattern notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3765
        lastSearchDirection := #backward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3766
        self rememberSearchPattern:lastSearchPattern.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3767
        self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3768
            searchBwd:lastSearchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3769
            ignoreCase:ign
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3770
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3771
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  3772
    "Modified: / 08-03-2012 / 14:26:25 / cg"
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
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3775
searchBwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3776
    "do a backward search"
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
    self searchBwd:pattern ifAbsent:[self showNotFound].
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3779
"/    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3780
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3781
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3782
    "Modified: / 21-09-2006 / 16:48:29 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3783
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3784
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3785
searchBwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3786
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3787
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3788
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3789
        searchBwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3790
                                        pattern:pattern)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3791
        ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3792
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3793
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3794
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3795
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3796
searchBwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3797
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3798
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3799
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3800
        searchBwd:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3801
        ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3802
        ifAbsent:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3803
                    self sensor compressKeyPressEventsWithKey:#FindPrev.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3804
                    self showNotFound
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3805
                 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3806
    "/ lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3807
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3808
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3809
    "Created: / 13-09-1997 / 06:18:00 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3810
    "Modified: / 23-03-2012 / 12:10:25 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3811
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3812
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3813
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3814
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3815
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3816
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3817
        searchBwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3818
                                        pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3819
                                        ignoreCase:ign)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3820
        ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3821
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3822
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3823
    "Created: 13.9.1997 / 06:18:41 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3824
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3825
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3826
searchBwd:pattern ignoreCase:ign match: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3827
    "do a backward search.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3828
    match pattern functionality is not yet available for backward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3829
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3830
    "/ lastSearchWasMatch := match.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3831
    self searchBwd:pattern ignoreCase:ign.
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3832
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  3833
    "Modified: / 23-03-2012 / 12:12:44 / cg"
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3834
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  3835
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3836
searchBwdUsingSpec:searchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3837
    "do a backward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3838
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3839
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3840
        searchBwdUsingSpec:searchSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3841
        ifAbsent:[self showNotFound].
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3842
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3843
"/    lastSearchIgnoredCase := false.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3844
    lastSearchPattern := searchSpec pattern string
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3845
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3846
    "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
  3847
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3848
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3849
searchBwdUsingSpec:searchSpec ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3850
    "do a backward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3851
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3852
    |pos startLine startCol|
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3853
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3854
    pos :=  self startPositionForSearchBackward.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3855
    startLine := pos y.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3856
    startCol := pos x.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3857
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3858
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3859
        searchBackwardUsingSpec:searchSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3860
        startingAtLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3861
        ifFound:[:line :col :endColOrNil|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3862
            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
  3863
        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3864
        ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3865
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  3866
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3867
searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3868
    "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
  3869
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3870
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3871
        searchForMatchingParenthesisFromLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3872
        ifFound:[:line :col |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3873
                  self selectFromLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3874
                               toLine:line col:col]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3875
        ifNotFound:[self showNotFound]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3876
        onError:[self beep]
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3877
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3878
    "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
  3879
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3880
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3881
searchForMatchingParenthesisFromLine:startLine col:startCol
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3882
                     ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3883
                  ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3884
                     onError:failBlock
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3885
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3886
    "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
  3887
     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
  3888
     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
  3889
     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
  3890
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3891
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3892
    ^ self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3893
        searchForMatchingParenthesisFromLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3894
        ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3895
        ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3896
        onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3897
        ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' )
3478
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3898
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  3899
    "Modified: / 12-04-2007 / 11:24:24 / cg"
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  3900
    "Modified (comment): / 13-02-2017 / 20:32:20 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3901
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3902
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3903
searchForMatchingParenthesisFromLine:startLine col:startCol
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3904
                     ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3905
                  ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3906
                     onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3907
                    ignoring:ignoreSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3908
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3909
    "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
  3910
     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
  3911
     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
  3912
     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
  3913
     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
  3914
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3915
    ^ self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3916
        searchForMatchingParenthesisFromLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3917
        ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3918
        ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3919
        onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3920
        openingCharacters: (parenthesisSpecification at:#open)  "/ #( $( $[ ${ "$> $<")
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3921
        closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<")
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3922
        ignoredCharacters: ignoreSet
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  3923
        specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3924
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3925
"/    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3926
"/     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3927
"/     ignoring
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3928
"/     line   "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3929
"/     col    "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3930
"/     delta  "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3931
"/     endCol "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3932
"/     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  3933
"/     cc prevCC nextCC incSet decSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3934
"/     nesting "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3935
"/     maxLine "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3936
"/     ign skip anySet|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3937
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3938
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3939
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3940
"/    parChar := self characterAtLine:startLine col:startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3941
"/    i := charSet indexOf:parChar.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3942
"/    i == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3943
"/        ^ failBlock value   "not a parenthesis"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3944
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3945
"/    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
  3946
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3947
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3948
"/    col := startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3949
"/    line := startLine.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3950
"/    direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3951
"/        delta := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3952
"/        incSet := #( $( $[ ${ "$<" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3953
"/        decSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3954
"/    ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3955
"/        delta := -1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3956
"/        incSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3957
"/        decSet := #( $( $[ ${ "$<" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3958
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3959
"/    anySet := Set new.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3960
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3961
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3962
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3963
"/    nesting := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3964
"/    ignoring := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3965
"/    lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3966
"/    maxLine := list size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3967
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3968
"/    col := col + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3969
"/    [nesting ~~ 0] whileTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3970
"/        (lineString notNil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3971
"/        and:[lineString includesAny:anySet]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3972
"/            direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3973
"/                endCol := lineString size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3974
"/            ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3975
"/                endCol := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3976
"/            ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3977
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3978
"/            col to:endCol by:delta do:[:rCol |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3979
"/                runCol := rCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3980
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3981
"/                cc := lineString at:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3982
"/                runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3983
"/                    nextCC := lineString at:runCol+1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3984
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3985
"/                    nextCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3986
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3987
"/                runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3988
"/                    prevCC := lineString at:runCol-1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3989
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3990
"/                    prevCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3991
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3992
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3993
"/                ign := skip := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3994
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3995
"/                "/ check for comments.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3996
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3997
"/                ((cc == $" and:[nextCC == $/])
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3998
"/                or:[prevCC == $$ ]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3999
"/                    "/ do nothing
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4000
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4001
"/                    skip := true.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4002
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4003
"/                    ignoreSet do:[:ignore |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4004
"/                        ignore == cc ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4005
"/                            ign := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4006
"/                        ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4007
"/                            ignore isString ifTrue:[
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4008
"/                                cc == (ignore at:2) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4009
"/                                    runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4010
"/                                        (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
  4011
"/                                            skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4012
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4013
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4014
"/                                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4015
"/                                    cc == (ignore at:1) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4016
"/                                        runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4017
"/                                            (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
  4018
"/                                                skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4019
"/                                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4020
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4021
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4022
"/                                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4023
"/                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4024
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4025
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4026
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4027
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4028
"/                ign ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4029
"/                    ignoring := ignoring not
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4030
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4031
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4032
"/                ignoring ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4033
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4034
"/                        (incSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4035
"/                            nesting := nesting + 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4036
"/                        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4037
"/                            (decSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4038
"/                                nesting := nesting - 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4039
"/                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4040
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4041
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4042
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4043
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4044
"/                nesting == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4045
"/                    "check if legal"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4046
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4047
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4048
"/                        cc == closingChar ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4049
"/                            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4050
"/                        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4051
"/                        ^ foundBlock value:line value:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4052
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4053
"/                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4054
"/            ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4055
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4056
"/        line := line + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4057
"/        (line < 1 or:[line > maxLine]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4058
"/            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4059
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4060
"/        lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4061
"/        direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4062
"/            col := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4063
"/        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4064
"/            col := lineString size
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4065
"/        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4066
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4067
"/    ^ notFoundBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4068
3478
13c5be5a11fe match without ignore
Claus Gittinger <cg@exept.de>
parents: 3459
diff changeset
  4069
    "Modified: / 12-04-2007 / 11:25:36 / cg"
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4070
    "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
  4071
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4072
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4073
searchForMatchingParenthesisFromLine:startLine col:startCol
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4074
                     ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4075
                  ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4076
                     onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4077
           openingCharacters:openingCharacters
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4078
           closingCharacters:closingCharacters
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4079
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4080
    "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
  4081
     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
  4082
     backwards if it's a closing parenthesis.
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4083
     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
  4084
     If there is a nesting error, evaluate failBlock."
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4085
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4086
    ^ self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4087
        searchForMatchingParenthesisFromLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4088
        ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4089
        ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4090
        onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4091
        openingCharacters: openingCharacters
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4092
        closingCharacters: closingCharacters
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4093
        ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#())
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4094
        specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4095
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4096
"/    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4097
"/     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4098
"/     ignoring
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4099
"/     line   "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4100
"/     col    "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4101
"/     delta  "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4102
"/     endCol "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4103
"/     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4104
"/     cc prevCC nextCC incSet decSet
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4105
"/     nesting "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4106
"/     maxLine "{ Class: SmallInteger }"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4107
"/     ign skip anySet|
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4108
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4109
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4110
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4111
"/    parChar := self characterAtLine:startLine col:startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4112
"/    i := charSet indexOf:parChar.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4113
"/    i == 0 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4114
"/        ^ failBlock value   "not a parenthesis"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4115
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4116
"/    direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4117
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4118
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4119
"/    col := startCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4120
"/    line := startLine.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4121
"/    direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4122
"/        delta := 1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4123
"/        incSet := #( $( $[ ${ "$<" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4124
"/        decSet := #( $) $] $} "$>" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4125
"/    ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4126
"/        delta := -1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4127
"/        incSet := #( $) $] $} "$>" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4128
"/        decSet := #( $( $[ ${ "$<" ).
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4129
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4130
"/    anySet := Set new.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4131
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4132
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4133
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4134
"/    nesting := 1.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4135
"/    ignoring := false.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4136
"/    lineString := list at:line.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4137
"/    maxLine := list size.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4138
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4139
"/    col := col + delta.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4140
"/    [nesting ~~ 0] whileTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4141
"/        (lineString notNil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4142
"/        and:[lineString includesAny:anySet]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4143
"/            direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4144
"/                endCol := lineString size.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4145
"/            ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4146
"/                endCol := 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4147
"/            ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4148
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4149
"/            col to:endCol by:delta do:[:rCol |
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4150
"/                runCol := rCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4151
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4152
"/                cc := lineString at:runCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4153
"/                runCol < lineString size ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4154
"/                    nextCC := lineString at:runCol+1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4155
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4156
"/                    nextCC := nil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4157
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4158
"/                runCol > 1 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4159
"/                    prevCC := lineString at:runCol-1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4160
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4161
"/                    prevCC := nil
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4162
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4163
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4164
"/                ign := skip := false.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4165
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4166
"/                "/ check for comments.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4167
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4168
"/                ((cc == $" and:[nextCC == $/])
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4169
"/                or:[prevCC == $$ ]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4170
"/                    "/ do nothing
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4171
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4172
"/                    skip := true.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4173
"/                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4174
"/                    ignoreSet do:[:ignore |
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4175
"/                        ignore == cc ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4176
"/                            ign := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4177
"/                        ] ifFalse:[
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4178
"/                            ignore isString ifTrue:[
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4179
"/                                cc == (ignore at:2) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4180
"/                                    runCol > 1 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4181
"/                                        (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4182
"/                                            skip := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4183
"/                                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4184
"/                                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4185
"/                                ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4186
"/                                    cc == (ignore at:1) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4187
"/                                        runCol < lineString size ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4188
"/                                            (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4189
"/                                                skip := true
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4190
"/                                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4191
"/                                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4192
"/                                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4193
"/                                ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4194
"/                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4195
"/                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4196
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4197
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4198
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4199
"/                ign ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4200
"/                    ignoring := ignoring not
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4201
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4202
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4203
"/                ignoring ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4204
"/                    skip ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4205
"/                        (incSet includes:cc) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4206
"/                            nesting := nesting + 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4207
"/                        ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4208
"/                            (decSet includes:cc) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4209
"/                                nesting := nesting - 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4210
"/                            ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4211
"/                        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4212
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4213
"/                ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4214
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4215
"/                nesting == 0 ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4216
"/                    "check if legal"
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4217
"/
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4218
"/                    skip ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4219
"/                        cc == closingChar ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4220
"/                            ^ failBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4221
"/                        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4222
"/                        ^ foundBlock value:line value:runCol.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4223
"/                    ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4224
"/                ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4225
"/            ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4226
"/        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4227
"/        line := line + delta.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4228
"/        (line < 1 or:[line > maxLine]) ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4229
"/            ^ failBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4230
"/        ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4231
"/        lineString := list at:line.
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4232
"/        direction == #fwd ifTrue:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4233
"/            col := 1
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4234
"/        ] ifFalse:[
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4235
"/            col := lineString size
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4236
"/        ]
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4237
"/    ].
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4238
"/    ^ notFoundBlock value
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4239
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4240
    "Modified: / 12-04-2007 / 11:25:36 / cg"
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4241
    "Modified (comment): / 13-02-2017 / 20:32:36 / cg"
3605
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4242
!
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4243
08a1c0d36701 parenthesis search fixed
Claus Gittinger <cg@exept.de>
parents: 3589
diff changeset
  4244
searchForMatchingParenthesisFromLine:startLine col:startCol
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4245
                     ifFound:foundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4246
                  ifNotFound:notFoundBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4247
                     onError:failBlock
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4248
           openingCharacters:openingCharacters
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4249
           closingCharacters:closingCharacters
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4250
           ignoredCharacters:ignoreSet
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4251
          specialEOLComment:eolCommentSequence
2553
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
    "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
  4254
     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
  4255
     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
  4256
     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
  4257
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4258
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4259
    |i direction lineString
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4260
     parChar charSet  closingChar
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4261
     ignoring
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4262
     line   "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4263
     col    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4264
     delta  "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4265
     endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4266
     runCol "{ Class: SmallInteger }"
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4267
     cc prevCC nextCC incSet decSet
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4268
     nesting "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  4269
     maxLine "{ Class: SmallInteger }"
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4270
     ign skip anySet
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4271
     eol1 eol2|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4272
2772
4e04a3bf399f check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4273
    self assert:(openingCharacters size == closingCharacters size).
4e04a3bf399f check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4274
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4275
    charSet := openingCharacters , closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4276
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4277
    parChar := self characterAtLine:startLine col:startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4278
    i := charSet indexOf:parChar.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4279
    i == 0 ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4280
        ^ failBlock value   "not a parenthesis"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4281
    ].
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4282
3858
1fd3e63fb456 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3851
diff changeset
  4283
    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
  4284
    closingChar := (closingCharacters , openingCharacters) at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4285
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4286
    eol1 := eolCommentSequence at:1 ifAbsent:nil.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  4287
    eol2 := eolCommentSequence at:2 ifAbsent:nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4288
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4289
    col := startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4290
    line := startLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4291
    direction == #fwd ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4292
        delta := 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4293
        incSet := openingCharacters.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4294
        decSet := closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4295
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4296
        delta := -1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4297
        incSet := closingCharacters.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4298
        decSet := openingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4299
    ].
1454
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4300
    anySet := Set new.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4301
    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  4302
    anySet := (anySet select:[:c | c isCharacter]) asString.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4303
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4304
    nesting := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4305
    ignoring := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4306
    lineString := list at:line.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4307
    maxLine := list size.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4308
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4309
    col := col + delta.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4310
    [nesting ~~ 0] whileTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4311
        (lineString notNil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4312
        and:[lineString includesAny:anySet]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4313
            direction == #fwd ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4314
                endCol := lineString size.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4315
            ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4316
                endCol := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4317
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4318
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4319
            col to:endCol by:delta do:[:rCol |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4320
                runCol := rCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4321
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4322
                cc := lineString at:runCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4323
                runCol < lineString size ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4324
                    nextCC := lineString at:runCol+1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4325
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4326
                    nextCC := nil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4327
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4328
                runCol > 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4329
                    prevCC := lineString at:runCol-1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4330
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4331
                    prevCC := nil
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4332
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4333
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4334
                ign := skip := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4335
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4336
                "/ check for comments.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4337
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4338
                ((cc == eol1 and:[nextCC == eol2])
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4339
                or:[prevCC == $$ ]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4340
                    "/ do nothing
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4341
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4342
                    skip := true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4343
                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4344
                    ignoreSet do:[:ignore |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4345
                        ignore == cc ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4346
                            ign := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4347
                        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4348
                            ignore isString ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4349
                                cc == (ignore at:2) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4350
                                    runCol > 1 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4351
                                        (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4352
                                            skip := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4353
                                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4354
                                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4355
                                ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4356
                                    cc == (ignore at:1) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4357
                                        runCol < lineString size ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4358
                                            (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4359
                                                skip := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4360
                                            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4361
                                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4362
                                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4363
                                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4364
                            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4365
                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4366
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4367
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4368
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4369
                ign ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4370
                    ignoring := ignoring not
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4371
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4372
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4373
                ignoring ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4374
                    skip ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4375
                        (incSet includes:cc) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4376
                            nesting := nesting + 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4377
                        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4378
                            (decSet includes:cc) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4379
                                nesting := nesting - 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4380
                            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4381
                        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4382
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4383
                ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4384
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4385
                nesting == 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4386
                    "check if legal"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4387
                    skip ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4388
                        cc == closingChar ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4389
                            ^ failBlock value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4390
                        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4391
                        ^ foundBlock value:line value:runCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4392
                    ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4393
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4394
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4395
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4396
        line := line + delta.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4397
        (line < 1 or:[line > maxLine]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4398
            ^ failBlock value
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4399
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4400
        lineString := list at:line.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4401
        direction == #fwd ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4402
            col := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4403
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4404
            col := lineString size
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4405
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4406
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4407
    ^ notFoundBlock value
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4408
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4409
    "Modified: / 15-10-1996 / 12:22:30 / cg"
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  4410
    "Modified (comment): / 13-02-2017 / 20:32:43 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4411
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4412
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4413
searchFwd
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4414
    "search forward for the same pattern or selection again"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4415
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4416
    |ign match variable|
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  4417
2811
3a7aed97fd76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  4418
    searchAction notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4419
        "/ autosearch is cleared whenever there is search with user selection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4420
        (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
4177
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4421
    ].
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4422
0d89dbb77071 changed: #searchFwd
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4423
    searchAction notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4424
        "/ 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
  4425
        self searchUsingSearchAction:#forward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4426
        ^ self.
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4427
    ].
3981
d45b096bb072 fixes in searchBar
fm
parents: 3970
diff changeset
  4428
    searchBarActionBlock notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4429
        searchBarActionBlock value:#forward value:self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4430
        ^ self
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4431
    ].
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4432
    lastSearchWasVariableSearch ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4433
        variable := self syntaxElementForSelectedVariable.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4434
        variable notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4435
            self searchVariableWithSyntaxElement:variable forward:true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4436
            ^ self.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4437
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4438
        lastSearchWasVariableSearch := false.
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4439
    ].
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4440
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4441
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4442
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  4443
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4444
    selectStyle == #wordLeft ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4445
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4446
         remove the space from the selection
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4447
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4448
        selectionStartCol := selectionStartCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4449
        super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4450
        selectStyle := #word.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4451
        self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4452
    ].
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4453
    self setSearchPatternWithMatchEscapes: match.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4454
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4455
    lastSearchPattern isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4456
        LastSearchPatterns size > 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4457
            lastSearchPattern := LastSearchPatterns first
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4458
        ]
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4459
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  4460
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4461
    lastSearchPattern notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4462
        self rememberSearchPattern:lastSearchPattern.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4463
        lastSearchDirection := #forward.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4464
        self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4465
            searchFwd:lastSearchPattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4466
            ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4467
            match: match
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4468
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4469
4399
7e1e1a3a8fbf better search (variable)
Claus Gittinger <cg@exept.de>
parents: 4397
diff changeset
  4470
    "Modified: / 08-03-2012 / 14:25:42 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4471
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4472
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4473
searchFwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4474
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4475
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4476
    self searchFwd:pattern ifAbsent:[self showNotFound].
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4477
"/    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4478
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4479
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4480
    "Modified: / 21-09-2006 / 16:52:04 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4481
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4482
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4483
searchFwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4484
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4485
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4486
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4487
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4488
                                pattern:pattern)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4489
        ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4490
3399
c350a2e3efee dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4491
    "Modified: / 21-09-2006 / 16:51:28 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4492
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4493
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4494
searchFwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4495
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4496
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4497
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4498
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4499
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4500
                                ignoreCase:ign)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4501
        ifAbsent:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4502
                    self sensor compressKeyPressEventsWithKey:#FindNext.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4503
                    self showNotFound
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4504
                 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4505
    "/ lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4506
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4507
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4508
    "Created: / 13-09-1997 / 06:18:13 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4509
    "Modified: / 23-03-2012 / 12:09:59 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4510
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4511
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4512
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4513
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4514
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4515
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4516
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4517
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4518
                                ignoreCase:ign)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4519
        ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4520
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4521
    "Modified: 13.9.1997 / 01:05:35 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4522
    "Created: 13.9.1997 / 06:18:27 / cg"
248
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
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4525
searchFwd:pattern ignoreCase:ign match: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4526
    "do a forward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4527
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4528
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4529
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4530
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4531
                                ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4532
                                match:match)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4533
        ifAbsent:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4534
                    self sensor compressKeyPressEventsWithKey:#FindNext.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4535
                    self showNotFound
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4536
                 ].
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4537
    "/ lastSearchIgnoredCase := ign.
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4538
    "/ lastSearchWasMatch := match.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4539
    lastSearchPattern := pattern string
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4540
4408
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4541
    "Created: / 13-09-1997 / 06:18:13 / cg"
1cba55e5141c changed:6 methods
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
  4542
    "Modified: / 23-03-2012 / 12:12:47 / cg"
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4543
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4544
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4545
searchFwd:pattern ignoreCase:ign match: match ifAbsent:aBlock
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4546
    "do a forward search"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4547
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4548
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4549
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4550
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4551
                                ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4552
                                match:match)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4553
        ifAbsent:aBlock
3581
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4554
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4555
    "Modified: 13.9.1997 / 01:05:35 / cg"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4556
    "Created: 13.9.1997 / 06:18:27 / cg"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4557
!
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4558
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4559
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4560
    "do a forward search"
950b9b6939ee StringSearchTool
fm
parents: 3577
diff changeset
  4561
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4562
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4563
        searchFwdUsingSpec:(ListView::SearchSpec new
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4564
                                pattern:pattern
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4565
                                ignoreCase:ign
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4566
                                match:match)
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4567
        startingAtLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4568
        ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4569
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4570
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4571
searchFwdUsingSpec:searchSpec
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4572
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4573
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4574
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4575
        searchFwdUsingSpec:searchSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4576
        ifAbsent:[self showNotFound].
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4577
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4578
"/    lastSearchIgnoredCase := false.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4579
    lastSearchPattern := searchSpec pattern string
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4580
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4581
    "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
  4582
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4583
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4584
searchFwdUsingSpec:searchSpec ifAbsent:aBlock
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4585
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4586
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4587
    |pos startLine startCol|
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4588
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4589
    pos := self startPositionForSearchForward.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4590
    startLine := pos y.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4591
    startCol := pos x.
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4592
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4593
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4594
        searchFwdUsingSpec:searchSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4595
        startingAtLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4596
        ifAbsent:aBlock
4462
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4597
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4598
    "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
  4599
    "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
  4600
!
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4601
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4602
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
  4603
    "do a forward search"
e7580f29c467 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
  4604
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4605
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4606
        searchForwardUsingSpec:searchSpec
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4607
        startingAtLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4608
        ifFound:[:line :col :endColOrNil|
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4609
            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
  4610
        ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4611
        ifAbsent:aBlock
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4612
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4613
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4614
searchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4615
    "return the last search pattern"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4616
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  4617
    ^ lastSearchPattern
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4618
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4619
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4620
searchUsingSearchAction:direction
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4621
    "search using a searchaction which has been given by someone else.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4622
     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
  4623
      a language aware search (as opposed to a naive string search)"
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4624
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4625
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4626
        searchUsingSearchAction:direction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4627
        ifAbsent:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4628
                    self sensor compressKeyPressEventsWithKey:#FindNext.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4629
                    self showNotFound
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4630
                 ]
2816
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4631
!
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4632
98eace39864f autosearch without beep
Claus Gittinger <cg@exept.de>
parents: 2814
diff changeset
  4633
searchUsingSearchAction:direction ifAbsent:notFoundAction
5714
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4634
    "search using a searchaction which has been given by someone else.
7da163a68f57 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5713
diff changeset
  4635
     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
  4636
      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
  4637
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4638
    |pos startLine startCol|
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4639
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4640
    pos :=  direction == #backward
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4641
                ifTrue:[self startPositionForSearchBackward]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4642
                ifFalse:[self startPositionForSearchForward].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4643
    startLine := pos y.
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4644
    startCol := pos x.
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4645
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4646
    searchAction notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4647
        searchAction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4648
            value:direction
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4649
            value:startLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4650
            value:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4651
            value:[:line :col | self selectFromLine:line toLine:line]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4652
            value:notFoundAction.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4653
        self hasSelection ifTrue: [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4654
            self changeTypeOfSelectionTo: #searchAction.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4655
        ].
2807
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4656
    ].
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4657
!
499d355a3f53 pluggable searchAction
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  4658
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4659
setSearchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4660
    "set the searchpattern from the selection if there is one"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4661
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4662
    self setSearchPatternWithMatchEscapes: false.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4663
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4664
3904
dd4c2dace4f5 changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents: 3892
diff changeset
  4665
setSearchPattern:aStringOrNil
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4666
    "set the searchpattern for future searches"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4667
3904
dd4c2dace4f5 changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents: 3892
diff changeset
  4668
    aStringOrNil isEmptyOrNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4669
        lastSearchPattern := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4670
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4671
        "/ not withoutSeparators: may want to search for spaces...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4672
        lastSearchPattern := aStringOrNil asString "withoutSeparators" string.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4673
    ].
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4674
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  4675
    "Modified: / 6.3.1999 / 23:47:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4676
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4677
2200
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4678
setSearchPattern:aString ignoreCase:aBoolean
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4679
    "set the searchpattern and caseIgnore for future searches"
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4680
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4681
    self setSearchPattern:aString.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4682
    lastSearchIgnoredCase := aBoolean.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4683
!
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  4684
5713
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4685
setSearchPattern:aString ignoreCase:ignoreCaseBoolean match:matchBoolean
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4686
    "set the searchpattern and caseIgnore for future searches"
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4687
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4688
    self setSearchPattern:aString.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4689
    lastSearchIgnoredCase := ignoreCaseBoolean.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4690
    lastSearchWasMatch := matchBoolean.
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4691
!
83f67e5544b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5677
diff changeset
  4692
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4693
setSearchPatternWithMatchEscapes: match
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4694
    "set the searchpattern from the selection if there is one"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4695
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4696
    |sel searchPattern |
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4697
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4698
"/    clickPos isNil ifTrue:[^ self].
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4699
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4700
    sel := self selection.
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4701
    sel notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4702
        searchPattern := sel asString.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4703
        match ifTrue:[searchPattern := searchPattern withMatchEscapes].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4704
        self setSearchPattern:searchPattern.
3577
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4705
    ]
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4706
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4707
    "Modified: / 6.3.1999 / 23:48:04 / cg"
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4708
!
092957d43987 searchForward with match argument
fm
parents: 3528
diff changeset
  4709
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4710
showMatch:pattern atLine:line col:col
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4711
    <resource: #obsolete>
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4712
    "after a search, highlight the matched pattern.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4713
     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
  4714
     (for now, it only highlights simple patterns and '*string*' correctly)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4715
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4716
    self showMatch:pattern isMatch:true atLine:line col:col endCol:nil
4120
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4717
!
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4718
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4719
showMatch:pattern isMatch:isMatch atLine:line col:col
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4720
    <resource: #obsolete>
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4721
    "after a search, highlight the matched pattern."
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4722
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4723
    self showMatch:pattern isMatch:isMatch atLine:line col:col endCol:nil
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4724
!
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4725
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4726
showMatch:pattern isMatch:isMatch atLine:line col:col endCol:encColOrNil
4120
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4727
    "after a search, highlight the matched pattern.
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4728
     The code below needs a rewrite to take care of match-characters
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4729
     (for now, it only highlights simple patterns and '*string*' correctly)"
499451998d77 added: #showMatch:isMatch:atLine:col:
fm
parents: 4101
diff changeset
  4730
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4731
    |endCol realPattern|
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4732
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4733
    (endCol := encColOrNil) isNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4734
        "/ a hack.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4735
        realPattern := pattern.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4736
        isMatch ifTrue: [
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4737
            (realPattern startsWith:$*) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4738
                realPattern := realPattern copyButFirst
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4739
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4740
            (realPattern endsWith:$*) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4741
                realPattern := realPattern copyButLast
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4742
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4743
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4744
        endCol := (col + realPattern size - 1).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4745
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4746
5716
f2d5d5d5d4d6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5714
diff changeset
  4747
    self selectFromLine:line col:col toLine:line col:endCol.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4748
    self makeLineVisible:line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4749
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4750
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4751
showNotFound
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4752
    "search not found - tell user by beeping and changing
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4753
     cursor for a while (sometimes I work with a headset :-)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4754
     (used to be: tell user by changing cursor for a while)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4755
5052
70780a6ab673 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5046
diff changeset
  4756
    self withCursor:(Cursor cross) do:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4757
        self beep.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4758
        Processor activeProcess millisecondDelay:200.
1028
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4759
    ]
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4760
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  4761
    "Modified: 20.2.1997 / 12:49:27 / cg"
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4762
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4763
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4764
startPositionForSearchBackward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4765
    ^ self startPositionForSearchBackwardBasedOnSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4766
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4767
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4768
startPositionForSearchBackwardBasedOnSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4769
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4770
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4771
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4772
        startLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4773
        startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4774
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4775
        startLine := 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4776
        startCol := 1
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4777
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4778
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4779
    ^ startCol @ startLine
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4780
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4781
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4782
startPositionForSearchForward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4783
    ^ self startPositionForSearchForwardBasedOnSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4784
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4785
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2821
diff changeset
  4786
startPositionForSearchForwardBasedOnSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4787
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4788
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4789
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4790
        startLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4791
        startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4792
    ] ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4793
        startLine := 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4794
        startCol := 1
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4795
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4796
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4797
    ^ startCol @ startLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4798
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4799
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4800
!TextView methodsFor:'selections'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4801
2604
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4802
changeTypeOfSelectionTo:newType
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4803
    "ignored here - but redefined in subclasses which
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4804
     differentiate between pasted- and user-selections"
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4805
!
2031eca912aa selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  4806
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4807
expandSelectionDown
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4808
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4809
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4810
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4811
        expandingTop == true ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4812
            l := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4813
            selectionStartLine := selectionStartLine + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4814
            (selectionStartLine > clickLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4815
            or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4816
            ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4817
                t := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4818
                selectionStartLine := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4819
                selectionEndLine := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4820
                t := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4821
                selectionStartCol := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4822
                selectionEndCol := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4823
                expandingTop := false
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4824
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4825
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4826
            l := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4827
            selectionEndLine := selectionEndLine + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4828
        ].
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  4829
"/        self redrawLine:l.
2442
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4830
"/        self redrawLine:l+1.
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4831
        self validateNewSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4832
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4833
        self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4834
        self redrawFromLine:l to:l+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4835
        self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4836
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4837
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4838
    "Created: / 01-03-1996 / 23:35:08 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4839
    "Modified: / 18-03-1996 / 17:18:15 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4840
    "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
  4841
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4842
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4843
expandSelectionLeft
502
6f3d0d7a782c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  4844
    |c l t c1 c2|
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4845
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4846
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4847
        expandingTop == true ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4848
            selectionStartCol == 0 ifTrue:[^ self].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4849
            l := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4850
            selectionStartCol := (selectionStartCol - 1) max:1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4851
            c := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4852
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4853
            l := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4854
            selectionEndCol := (selectionEndCol - 1) max:0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4855
            c := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4856
            selectionEndLine == selectionStartLine ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4857
                selectionEndCol <= selectionStartCol ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4858
                    t := selectionStartCol. selectionStartCol := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4859
                    selectionEndCol := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4860
                    expandingTop := true.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4861
                    c := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4862
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4863
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4864
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4865
        c1 := c.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4866
        c2 := c1 + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4867
        c1 == 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4868
            c1 := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4869
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4870
        self validateNewSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4871
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4872
        self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4873
        self redrawLine:l from:c1 to:c2.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4874
        self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4875
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4876
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4877
    "Modified: / 18-03-1996 / 17:05:46 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4878
    "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
  4879
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4880
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4881
expandSelectionRight
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4882
    |l c t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4883
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4884
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4885
        expandingTop == true ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4886
            l := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4887
            c := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4888
            selectionStartCol := selectionStartCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4889
            l == selectionEndLine ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4890
                c >= selectionEndCol ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4891
                    expandingTop := false.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4892
                    t := selectionStartCol. selectionStartCol := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4893
                    selectionEndCol := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4894
                    c := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4895
                ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4896
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4897
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4898
            l := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4899
            c := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4900
            selectionEndCol := selectionEndCol + 1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4901
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4902
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4903
        self validateNewSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4904
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4905
        self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4906
        self redrawLine:l from:(c max:1) to:c+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4907
        self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4908
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4909
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4910
    "Created: / 01-03-1996 / 23:33:17 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4911
    "Modified: / 06-03-1996 / 13:54:10 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4912
    "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
  4913
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4914
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4915
expandSelectionUp
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  4916
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4917
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4918
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4919
        expandingTop == true ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4920
            selectionStartLine := (selectionStartLine - 1) max:1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4921
            l := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4922
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4923
            selectionEndLine := (selectionEndLine - 1) max:0.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4924
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4925
            l := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4926
            (selectionEndLine < clickLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4927
            or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4928
            ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4929
                t := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4930
                selectionStartLine := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4931
                selectionEndLine := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4932
                t := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4933
                selectionStartCol := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4934
                selectionEndCol := t.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4935
                l := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4936
                expandingTop := true
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4937
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4938
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4939
        self validateNewSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4940
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4941
        self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4942
        "/ self redrawLine:l.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4943
        "/ self redrawLine:l+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4944
        self redrawFromLine:l to:l+1.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4945
        self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4946
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4947
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4948
    "Modified: / 06-03-1996 / 14:12:06 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  4949
    "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
  4950
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  4951
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4952
hasSelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4953
    "return true, if there is a selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4954
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4955
    ^ selectionStartLine notNil
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4956
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  4957
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4958
hasSelectionForCopy
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4959
    "return true, if there is a selection which can be copyied
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4960
     (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
  4961
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4962
    ^ self hasSelection
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4963
!
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  4964
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4965
hasSelectionWithinSingleLine
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4966
    "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
  4967
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4968
    ^ selectionStartLine notNil
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4969
      and:[ selectionStartLine == selectionEndLine ]
3315
1b42d2f8dcbc CRLF management
fm
parents: 3308
diff changeset
  4970
1b42d2f8dcbc CRLF management
fm
parents: 3308
diff changeset
  4971
    "Modified: / 04-07-2006 / 18:42:59 / fm"
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4972
!
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  4973
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4974
hasSingleFullLineSelected
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4975
    ^ (selectionStartLine notNil
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4976
      and:[selectionEndLine notNil
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5786
diff changeset
  4977
      and:[selectionEndLine == (selectionStartLine+1)
5004
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4978
      and:[selectionStartCol == 1
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4979
      and:[selectionEndCol == 0
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4980
    ]]]])
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4981
!
08314fa44f18 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
  4982
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4983
isInSelection:line col:aColNr
96256221e3af support drag
ca
parents: 2581
diff changeset
  4984
    "returns true, if the line, and column is in the selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  4985
    "
3438
d83030fd5005 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3426
diff changeset
  4986
    selectionStartLine isNil ifTrue:[^ false].
d83030fd5005 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3426
diff changeset
  4987
    selectionEndLine   isNil ifTrue:[^ false].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4988
96256221e3af support drag
ca
parents: 2581
diff changeset
  4989
    (line between:selectionStartLine and:selectionEndLine) ifFalse:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4990
        ^ false
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4991
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  4992
96256221e3af support drag
ca
parents: 2581
diff changeset
  4993
    line == selectionStartLine ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4994
        aColNr < selectionStartCol ifTrue:[^ false]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4995
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  4996
96256221e3af support drag
ca
parents: 2581
diff changeset
  4997
    line == selectionEndLine ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  4998
        (selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  4999
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  5000
    ^ true
96256221e3af support drag
ca
parents: 2581
diff changeset
  5001
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  5002
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5003
makeSelectionVisible
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5004
    "scroll to make the selection visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5005
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5006
    |line col|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5007
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5008
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5009
        expandingTop == true ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5010
            line := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5011
            col := selectionStartCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5012
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5013
            line := selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5014
            col := selectionEndCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5015
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5016
        self makeLineVisible:line.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5017
        self makeColVisible:col inLine:line.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5018
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5019
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  5020
    "Modified: 6.3.1996 / 13:53:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5021
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5022
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5023
selectAll
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5024
    "select the whole text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5025
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5026
    self selectFromLine:1 col:1 toLine:(list size + 1) col:0
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5027
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5028
4140
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5029
selectFromCharacterPosition:pos1
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5030
    "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
  5031
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5032
    |line1 col1 line2 col2|
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5033
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5034
    line1 := self lineOfCharacterPosition:pos1.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5035
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5036
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5037
    line2 := (list size + 1).
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5038
    col2 := 0.
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5039
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5040
!
435dc4fec8fb added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4120
diff changeset
  5041
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5042
selectFromCharacterPosition:pos1 to:pos2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5043
    "compute line/col from character positions and select the text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5044
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5045
    |line1 col1 line2 col2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5046
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  5047
    pos1 > pos2 ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5048
        ^ self unselect
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  5049
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5050
    line1 := self lineOfCharacterPosition:pos1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5051
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  5052
    col1 < 1 ifTrue:[ col1 := 1 ].
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  5053
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5054
    line2 := self lineOfCharacterPosition:pos2.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5055
    col2 := pos2 - (self characterPositionOfLine:line2 col:1) + 1.
4554
18662f9c1792 class: TextView
Claus Gittinger <cg@exept.de>
parents: 4534
diff changeset
  5056
    col2 < 1 ifTrue:[ col2 := 1 ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5057
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5058
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5059
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5060
selectFromLine:startLine col:startCol toLine:endLine col:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5061
    "select a piece of text and redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5062
5046
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  5063
    ((selectionStartLine = startLine)
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  5064
      and:[ (selectionStartCol = startCol)
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  5065
      and:[ (selectionEndLine = endLine)
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  5066
      and:[ (selectionEndCol = endCol) ]]]) ifTrue:[^ self ].
bcbf8cb1b3d1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
  5067
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5068
    self unselect.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5069
    startLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5070
        "new:"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5071
        endLine < startLine ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5072
            ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5073
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5074
        (endLine == startLine and:[endCol < startCol]) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5075
            endCol ~~ 0 ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5076
                self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5077
            ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5078
            ^ self
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5079
        ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5080
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5081
" old:
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5082
        endLine < startLine ifTrue:[^ self].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5083
        (startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5084
"
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5085
        selectionStartLine := startLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5086
        selectionStartCol := startCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5087
        selectionEndLine := endLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5088
        selectionEndCol := endCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5089
        self validateNewSelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5090
        self setPrimarySelection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5091
        self selectionChanged.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5092
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5093
        (selectionStartLine == selectionEndLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5094
            self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5095
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5096
            selectionStartLine to:selectionEndLine do:[:lineNr |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5097
                self redrawLine:lineNr
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5098
            ]
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5099
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5100
        selectStyle := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5101
    ]
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5102
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5103
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5104
     |v|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5105
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5106
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5107
     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
  5108
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5109
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5110
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5111
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5112
     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
  5113
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5114
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5115
    "Modified: / 02-01-1997 / 13:32:25 / cg"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5116
    "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
  5117
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5118
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5119
selectFromLine:startLine toLine:endLine
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5120
    "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
  5121
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5122
    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
  5123
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5124
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5125
     |v|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5126
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5127
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5128
     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
  5129
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5130
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5131
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5132
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5133
     v selectFromLine:2 toLine:10
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5134
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5135
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5136
    "Modified: 29.4.1996 / 12:23:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5137
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5138
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5139
selectLine:selectLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5140
    "select one line and redraw it"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5141
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5142
    self selectFromLine:selectLine col:1 toLine:(selectLine + 1) col:0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5143
    wordStartCol := selectionStartCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5144
    wordEndCol := selectionEndCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5145
    wordStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5146
    wordEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5147
    selectStyle := #line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5148
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5149
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5150
selectLineAtY:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5151
    "select the line at given y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5152
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  5153
    |selectLine|
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  5154
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  5155
    selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5156
    selectLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5157
        self selectLine:selectLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5158
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5159
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5160
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5161
selectLineWhereCharacterPosition:pos
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5162
    "select the line, where characterPosition pos is living.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5163
     The argument pos starts at 1 from the start of the text
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  5164
     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
  5165
     character position within a string to line-position in view)."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5166
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5167
    self selectLine:(self lineOfCharacterPosition:pos)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5168
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5169
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5170
selectWordAtLine:line col:col
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5171
    "select the word at given line/col"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5172
4500
1fe68567471d resizehandle
Claus Gittinger <cg@exept.de>
parents: 4499
diff changeset
  5173
    self
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5174
        wordAtLine:line col:col do:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5175
            :beginLine :beginCol :endLine :endCol :style |
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5176
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5177
            self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5178
            selectStyle := style
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5179
        ]
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5180
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5181
    "Modified: 18.3.1996 / 17:30:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5182
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5183
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5184
selectWordAtX:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5185
    "select the word at given x/y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5186
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5187
    |selectVisibleLine selectLine selectCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5188
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5189
    selectStyle := nil.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5190
    selectVisibleLine := self visibleLineOfY:y.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5191
    selectLine := self visibleLineToListLine:selectVisibleLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5192
    selectLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5193
        selectCol := self colOfX:x inVisibleLine:selectVisibleLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5194
        self selectWordAtLine:selectLine col:selectCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5195
    ]
1661
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5196
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5197
    "Modified: / 8.9.1998 / 21:22:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5198
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5199
3528
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5200
selectedInterval
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5201
    "return the selection-boundaries as interval"
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5202
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5203
    ^ self selectionStartIndex to:(self selectionStopIndex - 1)
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5204
!
753b5270dc2a +selectedInterval
Claus Gittinger <cg@exept.de>
parents: 3505
diff changeset
  5205
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5206
selection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5207
    "return the selection as a collection of (line-)strings.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5208
     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
  5209
     collection will be an empty string."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5210
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5211
    |sel|
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5212
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5213
    selectionStartLine isNil ifTrue:[^ nil].
4466
5c7a01426564 changed: #selection
Claus Gittinger <cg@exept.de>
parents: 4462
diff changeset
  5214
    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
  5215
    sel notEmptyOrNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5216
        "/ this is rubbish; we are now always using unicode internally
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5217
        "/ any many more conversions would be needed at many places...
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5218
        (gc characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5219
            sel := sel encodeFrom:gc characterEncoding into:#'iso10646-1'
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5220
        ].
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5221
    ].
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  5222
    ^ sel
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
  5223
4361
646cd7c5513e comment/format in: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents: 4321
diff changeset
  5224
    "Modified (comment): / 25-01-2012 / 00:29:09 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5225
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5226
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5227
selectionAsString
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5228
    "return the selection as a String (i.e. without emphasis)"
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5229
2693
9e7da8ff444d unused methodLocals removed
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
  5230
    |sel|
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5231
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5232
    (sel := self selection) isNil ifTrue:[^ nil].
2419
2ae3350454bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  5233
    sel := sel collect:[:each| each isNil ifTrue:[nil] ifFalse:[each string]].
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5234
    ^ (sel asStringWithCRsFrom:1 to:(sel size) compressTabs:false withCR:false) string
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5235
!
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  5236
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5237
selectionChanged
5658
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5238
    "can be redefined for notification or special actions.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5239
     If you do, do not forget to do a super selectionChanged"
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5240
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5241
    self changed:#selection.
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5242
"/    self selectionHolder value:{ selectionStartCol @ selectionStartLine .
bfc80e89fb1a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5612
diff changeset
  5243
"/                                 selectionEndCol @ selectionEndLine }
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5244
!
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5245
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5246
selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5247
    ^ selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5248
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5249
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5250
selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5251
    ^ selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5252
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5253
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5254
selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5255
    ^ selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5256
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5257
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5258
selectionStartLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5259
    ^ selectionStartLine
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
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5262
setPrimarySelection
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5263
    "can be redefined for notification or special actions"
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5264
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5265
    device notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5266
        "On X11, be nice and set the PRIMARY selection.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5267
         (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5268
        device setPrimaryText: self selectionAsString ownerView: self.
4419
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5269
    ].
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5270
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5271
    "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
  5272
!
a7436b36c0a0 added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4409
diff changeset
  5273
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5274
st80SelectMode
3459
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5275
    st80SelectMode notNil ifTrue:[^ st80SelectMode].
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5276
    ^ self class st80SelectMode
3308
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5277
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5278
    "Created: / 03-07-2006 / 16:30:59 / cg"
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5279
!
4c2c30b357c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3304
diff changeset
  5280
3459
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5281
st80SelectMode:aBoolean
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5282
    st80SelectMode := aBoolean
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5283
!
2767ddcf8bf0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3443
diff changeset
  5284
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5285
unselect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5286
    "unselect - if there was a selection redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5287
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5288
    |startLine endLine startVisLine endVisLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5289
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5290
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5291
        startLine := selectionStartLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5292
        endLine := selectionEndLine.
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 unselectWithoutRedraw.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5295
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5296
        "/ if the selection is not visible, we are done
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5297
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5298
        startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5299
        endLine < firstLineShown ifTrue:[^ self].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5300
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5301
        startLine < firstLineShown ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5302
            startVisLine := 1
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5303
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5304
            startVisLine := self listLineToVisibleLine:startLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5305
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5306
        endLine >= (firstLineShown + nLinesShown) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5307
            endVisLine := nLinesShown
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5308
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5309
            endVisLine := self listLineToVisibleLine:endLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5310
        ].
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5311
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  5312
        "/ 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
  5313
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5314
        (startLine == endLine) ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5315
            super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5316
        ] ifFalse:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5317
            self redrawFromVisibleLine:startVisLine to:endVisLine
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5318
        ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5319
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5320
    selectStyle := nil
503
468d4a36ed67 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
  5321
6099
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  5322
    "Modified: / 29-05-1996 / 14:54:11 / cg"
1d620265365d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
  5323
    "Modified (comment): / 13-02-2017 / 20:32:49 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5324
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5325
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5326
unselectWithoutRedraw
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5327
    "forget selection but do not redraw the selection area
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5328
     - 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
  5329
     known to be invisible (however, redraw knows about that anyway)."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5330
2735
5ba2010aefa4 *** empty log message ***
penk
parents: 2730
diff changeset
  5331
    selectionStartLine := selectionEndLine := nil.
4101
af694bc33754 added: #selectionChanged
Claus Gittinger <cg@exept.de>
parents: 4099
diff changeset
  5332
    self selectionChanged.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5333
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5334
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5335
validateNewSelection
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5336
     "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
  5337
      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
  5338
      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
  5339
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5340
    ^ self
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  5341
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  5342
    "Modified: 29.4.1996 / 12:32:08 / cg"
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5343
!
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5344
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5345
withSelectionForeground:hilightFg background:hilightBg do:aBlock
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5346
    "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
  5347
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5348
    |oldFg oldBg|
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5349
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5350
    "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5351
     change color of selection & hide cursor
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5352
    "
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5353
    oldFg := selectionFgColor.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5354
    oldBg := selectionBgColor.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5355
    selectionBgColor := hilightBg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5356
    selectionFgColor := hilightFg.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5357
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5358
    expandingTop := true.       "/ hack to make the top of the selection visible
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5359
    self makeSelectionVisible.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5360
    selectionStartLine notNil ifTrue:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5361
        selectionEndLine notNil ifTrue:[
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5362
            self redrawFromLine:selectionStartLine to:selectionEndLine.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5363
        ].
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5364
    ].
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5365
    self flush.
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5366
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5367
    aBlock ensure:[
5791
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5368
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5369
         undo selection color change and show cursor again
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5370
        "
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5371
        selectionFgColor := oldFg.
7594f171ab4d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  5372
        selectionBgColor := oldBg.
5378
d64277a079c1 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
  5373
    ].
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
4310
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5376
!TextView methodsFor:'testing'!
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5377
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5378
isTextView
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5379
    "I am showing text"
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5380
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5381
    ^ true
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5382
! !
ff92dd203d7e category of: #isTextView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  5383
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  5384
!TextView class methodsFor:'documentation'!
248
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
version
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  5387
    ^ '$Header$'
3964
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5388
!
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5389
f272bb5029f0 *** empty log message ***
fm
parents: 3914
diff changeset
  5390
version_CVS
5374
ad599b69af13 class: TextView
Claus Gittinger <cg@exept.de>
parents: 5326
diff changeset
  5391
    ^ '$Header$'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  5392
! !
2630
f3c95e73f862 for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2604
diff changeset
  5393
4485
758e9ff26eda class: TextView
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
  5394
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  5395
TextView initialize!