TextView.st
author Stefan Vogel <sv@exept.de>
Sat, 22 Nov 2014 11:38:13 +0100
branchdelegated_gc
changeset 5154 b8ffbe20c669
parent 5118 62c457aa688e
permissions -rw-r--r--
Synchronize with trunk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     1
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     4
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    10
 hereby transferred.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    11
"
5118
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
    12
'From Smalltalk/X, Version:6.2.4.0 on 22-07-2014 at 21:16:51'                   !
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    13
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libwidg' }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    15
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    16
ListView subclass:#TextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    18
		selectionEndCol clickPos clickStartLine clickStartCol clickLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    19
		clickCol clickCount expandingTop wordStartCol wordStartLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    20
		wordEndCol wordEndLine selectionFgColor selectionBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    21
		selectStyle directoryForFileDialog defaultFileNameForFileDialog
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    22
		externalEncoding contentsWasSaved searchAction lastSearchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    23
		lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    24
		lastSearchWasVariableSearch parenthesisSpecification dropSource
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    25
		dragIsActive saveAction st80SelectMode searchBarActionBlock'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    26
	classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    27
		DefaultSelectionBackgroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    28
		DefaultAlternativeSelectionForegroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    29
		DefaultAlternativeSelectionBackgroundColor MatchDelayTime
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    30
		WordSelectCatchesBlanks LastSearchPatterns
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    31
		NumRememberedSearchPatterns LastSearchIgnoredCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    32
		LastSearchWasMatch DefaultParenthesisSpecification'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    33
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    34
	category:'Views-Text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    35
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    36
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    37
!TextView class methodsFor:'documentation'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    38
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    39
copyright
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    40
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    41
 COPYRIGHT (c) 1989 by Claus Gittinger
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    42
	      All Rights Reserved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    43
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    44
 This software is furnished under a license and may be used
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    45
 only in accordance with the terms of that license and with the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    46
 inclusion of the above copyright notice.   This software may not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    47
 be provided or otherwise made available to, or used by, any
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    48
 other person.  No title to or ownership of the software is
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    49
 hereby transferred.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    50
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    51
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    52
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    53
documentation
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    54
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    55
    a view for readOnly text - this class adds selections to a simple list.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    56
    The text is not editable and there is no cursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    57
    Use TextViews for readonly text, EditTextView for editable text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    58
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    59
    Please read the historic notice in the ListView class.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    60
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    61
    [Instance variables:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    62
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    63
      selectionStartLine      <Number>                the line of the selection start (or nil)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    64
      selectionStartCol       <Number>                the col of the selection start
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    65
      selectionEndLine        <Number>                the line of the selection end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    66
      selectionEndCol         <Number>                the col of the selection end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    67
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    68
      clickStartLine          <Number>                temporary - remember where select operation started
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    69
      clickStartCol           <Number>                temporary
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    70
      clickLine               <Number>                temporary
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    71
      clickCol                <Number>                temporary
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    72
      clickCount              <Number>                temporary
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    73
      expandingTop            <Boolean>               temporary - for expandSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    74
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    75
      selectionFgColor        <Color>                 color used to draw selections
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    76
      selectionBgColor        <Color>                 color used to draw selections
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    77
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    78
      selectStyle             <Symbol>                how words are selected
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    79
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    80
      directoryForFileDialog  <nil|pathName>          directory where save dialog should start
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    81
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    82
      contentsWasSaved        <Boolean>               set to true, whenever saved in a file
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    83
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    84
      externalEncoding        <Symbol|nil>            external encoding, used when text is saved to
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    85
						      a file. Usually something like
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    86
						      #jis7, #euc, #sjis etc.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    87
						      (currently only passed down from the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    88
						       fileBrowser)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    89
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    90
      dropSource              <DropSource>            drag operation descriptor or nil (dragging disabled)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    91
      dragIsActive            <Boolean>               true, drag operation is activated
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    92
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    93
      searchAction            <Block>                 an autosearch action; typically set by the browser.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    94
						      Will be used as default when searchFwd/searchBwd is
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    95
						      pressed. If the searchPattern is changed, no autosearch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    96
						      action will be executed.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    97
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    98
      searchBarActionBlock    <Block>                 search action block for embedded search
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    99
						      panel. Used as second chance for searchFwd/bwd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   100
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   101
    [class variables:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   102
	ST80Selections        <Boolean>               enables ST80 style doubleclick behavior
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   103
						      (right after opening parenthesis, right before
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   104
						       closing parenthesis, at begin of a line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   105
						       at begin of text)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   106
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   107
    [StyleSheet parameters:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   108
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   109
      textView.background                       defaults to viewBackground
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   110
      textView.ViewFont                         defaults to textFont
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   111
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   112
      text.st80Selections                       st80 behavior (click on char after parent or quote)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   113
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   114
      text.selectionForegroundColor             defaults to textBackgroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   115
      text.selectionBackgroundColor             defaults to textForegroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   116
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   117
      text.alternativeSelectionForegroundColor  pasted text (i.e. paste will not replace)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   118
						defaults to selectionForegroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   119
      text.alternativeSelectionBackgroundColor  pasted text (i.e. paste will not replace)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   120
						defaults to selectionBackgroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   121
    [author:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   122
	Claus Gittinger
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   123
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   124
    [see also:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   125
	EditTextView CodeView Workspace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   126
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   127
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   128
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   129
examples
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   130
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   131
    although textViews (and instances of subclasses) are mostly used
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   132
    as components (in the fileBrowser, the browser, the launcher etc.),
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   133
    they may also be opened as a textEditor;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   134
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   135
    open a (readonly) textView on some information text:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   136
							[exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   137
	TextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   138
	    openWith:'read this'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   139
	    title:'demonstration'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   140
							[exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   141
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   142
    the same, but open it modal:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   143
							[exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   144
	TextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   145
	    openModalWith:'read this first'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   146
	    title:'demonstration'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   147
							[exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   148
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   149
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   150
    open it modal (but editable) on some text:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   151
    (must accept before closing)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   152
    This is somewhat kludgy - when closed, the view has already
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   153
    nilled its link to the model. Therefore, the accept must be
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   154
    done 'manually' below.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   155
    However, usually an applicationModel is installed as the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   156
    editor-topViews application. This would get a closeRequest,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   157
    where it could handle things.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   158
							[exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   159
	|m textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   160
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   161
	m := 'read this first' asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   162
	textView := EditTextView openModalOnModel:m.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   163
	textView modified ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   164
	    (self confirm:'text was not accepted - do it now ?')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   165
	    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   166
		m value:textView contents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   167
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   168
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   169
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   170
	Transcript showCR:m value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   171
							[exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   172
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   173
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   174
    open a textEditor on some file:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   175
							[exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   176
	EditTextView openOn:'Makefile'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   177
							[exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   178
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   179
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   180
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   181
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   182
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   183
!TextView class methodsFor:'instance creation'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   184
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   185
on:aModel aspect:aspect change:change menu:menu initialSelection:initial
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   186
    "for ST-80 compatibility"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   187
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   188
    ^ (self new)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   189
	on:aModel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   190
	aspect:aspect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   191
	list:aspect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   192
	change:change
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   193
	menu:menu
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   194
	initialSelection:initial
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   195
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   196
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   197
with:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   198
    ^ (self new)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   199
	contents:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   200
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   201
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   202
!TextView class methodsFor:'class initialization'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   203
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   204
initialize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   205
    DefaultParenthesisSpecification isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   206
	DefaultParenthesisSpecification := IdentityDictionary new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   207
	DefaultParenthesisSpecification at:#open        put:#( $( $[ ${ "$> $<") .
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   208
	DefaultParenthesisSpecification at:#close       put:#( $) $] $} "$> $<").
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   209
	DefaultParenthesisSpecification at:#ignore      put:#( $' $" '$[' '$]' '${' '$)' ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   210
	DefaultParenthesisSpecification at:#eolComment  put:'"/'.     "/ sigh - must be 2 characters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   211
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   212
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   213
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   214
!TextView class methodsFor:'defaults'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   215
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   216
defaultIcon
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   217
    "return the default icon if started as a topView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   218
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   219
    <resource: #programImage>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   220
    <resource: #style (#ICON #ICON_FILE)>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   221
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   222
    |nm i|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   223
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   224
    i := self classResources at:'ICON' default:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   225
    i isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   226
	nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   227
	i := Smalltalk imageFromFileNamed:nm forClass:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   228
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   229
    i notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   230
	i := i onDevice:Display
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   231
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   232
    ^ i
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   233
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   234
    "Modified: / 17-09-2007 / 11:36:29 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   235
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   236
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   237
defaultMenuMessage
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   238
    "This message is the default yo be sent to the menuHolder to get a menu"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   239
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   240
    ^ #editMenu
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   241
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   242
    "Created: 3.1.1997 / 01:52:21 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   243
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   244
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   245
defaultParenthesisSpecification
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   246
    ^ DefaultParenthesisSpecification
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   247
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   248
    "Created: / 14-06-2011 / 14:00:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   249
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   250
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   251
defaultSelectionBackgroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   252
    "return the default selection background color"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   253
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   254
    ^DefaultSelectionBackgroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   255
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   256
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   257
defaultSelectionForegroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   258
    "return the default selection foreground color"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   259
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   260
    ^DefaultSelectionForegroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   261
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   262
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   263
defaultViewBackgroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   264
    "return the default view background"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   265
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   266
    ^DefaultViewBackground
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   267
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   268
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   269
lastSearchIgnoredCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   270
    ^ LastSearchIgnoredCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   271
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   272
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   273
lastSearchWasMatch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   274
    ^ LastSearchWasMatch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   275
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   276
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   277
st80SelectMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   278
    ^ UserPreferences current st80SelectMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   279
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   280
    "Modified: / 03-07-2006 / 16:26:44 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   281
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   282
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   283
st80SelectMode:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   284
    UserPreferences current st80SelectMode:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   285
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   286
    "Created: / 07-01-1999 / 13:35:24 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   287
    "Modified: / 03-07-2006 / 16:27:01 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   288
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   289
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   290
updateStyleCache
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   291
    "extract values from the styleSheet and cache them in class variables"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   292
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   293
    <resource: #style (#'textView.background'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   294
		       #'text.selectionForegroundColor'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   295
		       #'text.selectionBackgroundColor'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   296
		       #'text.alternativeSelectionForegroundColor'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   297
		       #'text.alternativeSelectionBackgroundColor'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   298
		       #'textView.font'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   299
		       #'text.wordSelectCatchesBlanks'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   300
		       #'text.st80Selections')>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   301
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   302
    DefaultViewBackground := StyleSheet colorAt:'textView.background' default:Color white.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   303
    DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   304
    DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   305
"/    DefaultAlternativeSelectionForegroundColor := StyleSheet colorAt:'text.alternativeSelectionForegroundColor' default:DefaultSelectionForegroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   306
"/    DefaultAlternativeSelectionBackgroundColor := StyleSheet colorAt:'text.alternativeSelectionBackgroundColor' default:DefaultSelectionBackgroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   307
    DefaultAlternativeSelectionForegroundColor := DefaultSelectionForegroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   308
    DefaultAlternativeSelectionBackgroundColor := DefaultSelectionBackgroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   309
    DefaultFont := StyleSheet fontAt:'textView.font'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   310
    MatchDelayTime := 0.6.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   311
    WordSelectCatchesBlanks := StyleSheet at:'text.wordSelectCatchesBlanks' default:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   312
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   313
    "Modified: / 03-07-2006 / 16:29:42 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   314
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   315
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   316
!TextView class methodsFor:'help specs'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   317
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   318
flyByHelpSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   319
    "This resource specification was automatically generated
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   320
     by the UIHelpTool of ST/X."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   321
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   322
    "Do not manually edit this!! If it is corrupted,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   323
     the UIHelpTool may not be able to read the specification."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   324
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   325
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   326
     UIHelpTool openOnClass:TextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   327
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   328
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   329
    <resource: #help>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   330
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   331
    ^ Dictionary new addPairsFrom:#(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   332
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   333
#matchSearch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   334
'Search for a pattern (glob) as opposed to a direct string search'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   335
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   336
#searchCaseSensitive
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   337
'Care for case differences'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   338
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   339
#searchFullWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   340
'Search only for full words (ignore occurrences as substring)'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   341
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   342
#searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   343
'String or match-pattern to be searched'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   344
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   345
#searchVariable
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   346
'Search only for that variable name (ignore occurrences in other contexts)'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   347
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   348
#replaceText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   349
'If checked, matching text is replaced by this (everywhere)'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   350
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   351
#selectLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   352
'If checked, lines containing the matched string are selected.'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   353
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   354
)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   355
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   356
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   357
!TextView class methodsFor:'interface specs'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   358
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   359
searchDialogSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   360
    "This resource specification was automatically generated
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   361
     by the UIPainter of ST/X."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   362
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   363
    "Do not manually edit this!! If it is corrupted,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   364
     the UIPainter may not be able to read the specification."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   365
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   366
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   367
     UIPainter new openOnClass:TextView andSelector:#searchDialogSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   368
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   369
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   370
    <resource: #canvas>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   371
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   372
    ^
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   373
    #(FullSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   374
       name: searchDialogSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   375
       window:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   376
      (WindowSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   377
	 label: 'String search'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   378
	 name: 'String search'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   379
	 min: (Point 10 10)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   380
	 max: (Point 1280 1024)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   381
	 bounds: (Rectangle 0 0 302 242)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   382
       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   383
       component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   384
      (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   385
	 collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   386
	  (LabelSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   387
	     label: 'SearchPattern:'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   388
	     name: 'label'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   389
	     layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   390
	     level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   391
	     translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   392
	     adjust: left
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   393
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   394
	  (ComboBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   395
	     name: 'patternComboBox'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   396
	     layout: (LayoutFrame 2 0.0 26 0 -2 1.0 48 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   397
	     activeHelpKey: searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   398
	     tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   399
	     model: searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   400
	     immediateAccept: false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   401
	     acceptOnLeave: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   402
	     acceptOnReturn: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   403
	     acceptOnTab: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   404
	     acceptOnLostFocus: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   405
	     acceptOnPointerLeave: false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   406
	     autoSelectInitialText: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   407
	     comboList: patternList
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   408
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   409
	  (VerticalPanelViewSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   410
	     name: 'VerticalPanel1'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   411
	     layout: (LayoutFrame 0 0.0 52 0 0 1.0 -30 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   412
	     horizontalLayout: fit
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   413
	     verticalLayout: top
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   414
	     component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   415
	    (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   416
	       collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   417
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   418
		   label: 'Case Sensitive'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   419
		   name: 'ignoreCaseCheckBox'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   420
		   activeHelpKey: searchCaseSensitive
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   421
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   422
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   423
		   model: caseSensitive
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   424
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   425
		   extent: (Point 302 24)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   426
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   427
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   428
		   label: 'Match (forward only)'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   429
		   name: 'matchCheckBox'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   430
		   activeHelpKey: matchSearch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   431
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   432
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   433
		   model: match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   434
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   435
		   extent: (Point 302 24)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   436
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   437
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   438
		   label: 'Search Full Words'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   439
		   name: 'CheckBox2'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   440
		   activeHelpKey: searchFullWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   441
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   442
		   enableChannel: searchFullWordEnabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   443
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   444
		   model: searchFullWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   445
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   446
		   extent: (Point 302 24)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   447
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   448
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   449
		   label: 'Variable Only'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   450
		   name: 'CheckBox1'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   451
		   activeHelpKey: searchVariable
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   452
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   453
		   visibilityChannel: searchVariableVisible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   454
		   enableChannel: searchVariableEnabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   455
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   456
		   model: searchVariable
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   457
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   458
		   labelChannel: stringWithVariableUnderCursorHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   459
		   extent: (Point 302 24)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   460
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   461
		(CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   462
		   label: 'Select Lines'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   463
		   name: 'CheckBox3'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   464
		   activeHelpKey: selectLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   465
		   level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   466
		   initiallyInvisible: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   467
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   468
		   model: selectLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   469
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   470
		   extent: (Point 302 24)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   471
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   472
		(ViewSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   473
		   name: 'Box1'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   474
		   component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   475
		  (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   476
		     collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   477
		      (CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   478
			 label: 'Global Replace With:'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   479
			 name: 'CheckBox4'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   480
			 layout: (LayoutFrame 0 0 0 0 162 0 23 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   481
			 activeHelpKey: replaceText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   482
			 level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   483
			 enableChannel: replaceEnabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   484
			 tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   485
			 model: replaceBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   486
			 translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   487
		       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   488
		      (InputFieldSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   489
			 name: 'ReplaceEntryField'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   490
			 layout: (LayoutFrame 164 0 0 0 -2 1 22 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   491
			 activeHelpKey: replaceText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   492
			 visibilityChannel: replaceBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   493
			 enableChannel: replaceBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   494
			 model: replaceTextHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   495
			 acceptOnReturn: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   496
			 acceptOnTab: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   497
			 acceptOnPointerLeave: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   498
		       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   499
		      )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   500
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   501
		   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   502
		   extent: (Point 302 24)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   503
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   504
		)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   505
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   506
	     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   507
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   508
	  (HorizontalPanelViewSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   509
	     name: 'horizontalPanelView'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   510
	     layout: (LayoutFrame 0 0.0 -30 1.0 -16 1.0 0 1.0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   511
	     level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   512
	     horizontalLayout: fitSpace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   513
	     verticalLayout: center
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   514
	     horizontalSpace: 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   515
	     verticalSpace: 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   516
	     ignoreInvisibleComponents: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   517
	     reverseOrderIfOKAtLeft: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   518
	     component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   519
	    (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   520
	       collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   521
		(ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   522
		   label: 'Cancel'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   523
		   name: 'cancelButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   524
		   level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   525
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   526
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   527
		   model: cancel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   528
		   extent: (Point 91 21)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   529
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   530
		(ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   531
		   label: 'Prev'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   532
		   name: 'prevButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   533
		   level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   534
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   535
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   536
		   model: prevAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   537
		   extent: (Point 91 21)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   538
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   539
		(ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   540
		   label: 'Next'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   541
		   name: 'nextButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   542
		   level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   543
		   borderWidth: 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   544
		   translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   545
		   tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   546
		   model: nextAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   547
		   isDefault: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   548
		   extent: (Point 90 21)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   549
		 )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   550
		)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   551
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   552
	     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   553
	     keepSpaceForOSXResizeHandleH: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   554
	   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   555
	  )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   556
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   557
       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   558
     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   559
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   560
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   561
!TextView class methodsFor:'startup'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   562
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   563
open
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   564
    "start an empty TextView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   565
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   566
    ^ self openWith:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   567
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   568
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   569
openModalOnModel:aModel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   570
    "start a textView on a model; return the textView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   571
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   572
    |textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   573
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   574
    textView := self setupForModel:aModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   575
    textView topView openModal.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   576
    ^ textView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   577
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   578
    "Created: 14.2.1997 / 15:24:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   579
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   580
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   581
openModalWith:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   582
    "start a textView with aString as initial contents"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   583
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   584
    ^ self openModalWith:aString title:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   585
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   586
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   587
     TextView openModalWith:'some text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   588
     EditTextView openModalWith:'some text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   589
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   590
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   591
    "Created: 14.2.1997 / 15:19:04 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   592
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   593
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   594
openModalWith:aString title:aTitle
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   595
    "start a textView with aString as initial contents. Return the textView."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   596
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   597
    |textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   598
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   599
    textView := self setupWith:aString title:aTitle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   600
    textView topView openModal.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   601
    ^ textView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   602
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   603
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   604
     TextView openModalWith:'some text' title:'testing'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   605
     EditTextView openModalWith:'some text' title:'testing'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   606
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   607
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   608
    "Modified: 9.9.1996 / 19:32:29 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   609
    "Created: 14.2.1997 / 15:19:18 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   610
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   611
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   612
openOn:aFileName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   613
    "start a textView on a file; return the textView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   614
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   615
    |textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   616
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   617
    textView := self setupForFile:aFileName.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   618
    textView topView open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   619
    ^ textView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   620
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   621
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   622
     TextView openOn:'../../doc/overview.doc'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   623
     EditTextView openOn:'../../doc/overview.doc'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   624
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   625
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   626
    "Modified: 14.2.1997 / 15:21:51 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   627
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   628
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   629
openOnModel:aModel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   630
    "start a textView on a model; return the textView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   631
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   632
    |textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   633
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   634
    textView := self setupForModel:aModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   635
    textView topView open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   636
    ^ textView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   637
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   638
    "Created: 14.2.1997 / 15:23:36 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   639
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   640
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   641
openWith:aStringOrStringCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   642
    "start a textView with aStringOrStringCollection as initial contents"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   643
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   644
    ^ self openWith:aStringOrStringCollection selected:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   645
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   646
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   647
     TextView openWith:'some text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   648
     EditTextView openWith:'some text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   649
     Workspace openWith:'some text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   650
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   651
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   652
    "Created: 10.12.1995 / 17:41:32 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   653
    "Modified: 5.3.1997 / 15:37:19 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   654
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   655
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   656
openWith:aStringOrStringCollection selected:selectedBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   657
    "start a textView with aStringOrStringCollection as initial (optionally selected) contents.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   658
     Return the textView."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   659
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   660
    |textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   661
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   662
    textView := self setupEmpty.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   663
    textView contents:aStringOrStringCollection selected:selectedBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   664
    textView topView open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   665
    ^ textView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   666
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   667
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   668
     TextView openWith:'some text' selected:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   669
     EditTextView openWith:'some text' selected:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   670
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   671
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   672
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   673
openWith:aStringOrStringCollection title:aTitle
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   674
    "start a textView with aStringOrStringCollection as initial contents. Return the textView."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   675
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   676
    |textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   677
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   678
    textView := self setupWith:aStringOrStringCollection title:aTitle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   679
    textView topView open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   680
    ^ textView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   681
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   682
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   683
     TextView openWith:'some text' title:'testing'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   684
     EditTextView openWith:'some text' title:'testing'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   685
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   686
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   687
    "Created: 10.12.1995 / 17:40:02 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   688
    "Modified: 5.3.1997 / 15:37:26 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   689
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   690
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   691
setupEmpty
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   692
    "create a textview in a topview, with horizontal and
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   693
     vertical scrollbars - a helper for #startWith: and #startOn:"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   694
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   695
    |top frame label|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   696
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   697
    label := 'unnamed'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   698
    top := StandardSystemView label:label icon:self defaultIcon.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   699
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   700
    frame := HVScrollableView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   701
		for:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   702
		miniScrollerH:true miniScrollerV:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   703
		in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   704
    frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   705
    ^ frame scrolledView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   706
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   707
    "Modified: 23.5.1965 / 14:12:32 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   708
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   709
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   710
setupForFile:aFileName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   711
    "setup a textView on a file; return the textView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   712
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   713
    |textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   714
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   715
    textView := self setupEmpty.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   716
    aFileName notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   717
	textView setupForFile:aFileName.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   718
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   719
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   720
    ^ textView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   721
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   722
    "Created: / 14-02-1997 / 15:21:43 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   723
    "Modified: / 25-10-2006 / 14:46:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   724
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   725
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   726
setupForModel:aModel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   727
    "setup a textView on a model; return the textView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   728
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   729
    |textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   730
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   731
    textView := self setupEmpty.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   732
    textView model:aModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   733
    ^ textView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   734
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   735
    "Created: 14.2.1997 / 15:22:42 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   736
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   737
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   738
setupWith:aStringOrStringCollection title:aTitle
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   739
    "setup a textView with aStringOrStringCollection as initial contents in a topView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   740
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   741
    |top textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   742
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   743
    textView := self setupEmpty.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   744
    top := textView topView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   745
    aTitle notNil ifTrue:[top label:aTitle].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   746
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   747
    aStringOrStringCollection notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   748
	textView contents:aStringOrStringCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   749
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   750
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   751
    ^ textView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   752
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   753
    "Created: 9.9.1996 / 19:31:22 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   754
    "Modified: 5.3.1997 / 15:37:37 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   755
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   756
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   757
!TextView methodsFor:'Compatibility-ST80'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   758
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   759
displaySelection:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   760
    "ST-80 compatibility: ignored here."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   761
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   762
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   763
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   764
editText:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   765
    "ST-80 compatibility: set the edited text."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   766
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   767
    self contents:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   768
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   769
    "Created: / 5.2.2000 / 17:06:18 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   770
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   771
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   772
selectAndScroll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   773
    "ST-80 compatibility: ignored here."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   774
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   775
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   776
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   777
selectFrom:startPos to:endPos
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   778
    "change the selection given two character positions."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   779
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   780
    self selectFromCharacterPosition:startPos to:endPos
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   781
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   782
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   783
selectionStartIndex
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   784
    "ST-80 compatibility: return the selections start character position."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   785
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   786
    ^ self characterPositionOfSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   787
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   788
    "Created: / 19.6.1998 / 00:21:44 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   789
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   790
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   791
selectionStopIndex
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   792
    "ST-80 compatibility: return the character position of
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   793
     the character right after the selection."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   794
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   795
    |idx|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   796
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   797
    idx := self characterPositionOfSelectionEnd.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   798
    idx == 0 ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   799
    ^ idx + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   800
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   801
    "Created: / 19.6.1998 / 00:22:08 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   802
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   803
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   804
!TextView methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   805
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   806
characterEncoding:encodingArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   807
    "define how the contents is encoded internally.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   808
     This should normally never be required, as ST/X now assumes
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   809
     unicode (of which iso8859-1 is a subset) encoding.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   810
     The possibility to change the characterEncoding is provided as
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   811
     a backward compatibility hook for programs which want to use
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   812
     another encoding internally."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   813
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   814
    |encodingSymOrNil|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   815
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   816
    encodingSymOrNil := encodingArg isNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   817
			    ifTrue:[#'iso10646-1']
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   818
			    ifFalse:[encodingArg asSymbol].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   819
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   820
    gc characterEncoding ~~ encodingSymOrNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   821
	"/ TODO: reencode contents if required.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   822
	(list size ~~ 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   823
	and:[ list contains:[:line | line size > 0]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   824
	    (self confirm:'Your text may need to be re-coded - this is not yet supported.\\Proceed ?')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   825
	    ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   826
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   827
	super characterEncoding:encodingSymOrNil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   828
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   829
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   830
    "Modified (format): / 25-01-2012 / 00:28:27 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   831
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   832
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   833
characterPositionOfSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   834
    "return the character index of the first character in the selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   835
     Returns 0 if there is no selection."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   836
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   837
    selectionStartLine isNil ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   838
    ^ self characterPositionOfLine:selectionStartLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   839
			       col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   840
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   841
    "Modified: 14.8.1997 / 16:35:37 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   842
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   843
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   844
characterPositionOfSelectionEnd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   845
    "return the character index of the last character in the selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   846
     Returns 0 if there is no selection."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   847
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   848
    selectionStartLine isNil ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   849
    ^ self characterPositionOfLine:selectionEndLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   850
			       col:selectionEndCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   851
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   852
    "Created: 14.8.1997 / 16:35:24 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   853
    "Modified: 14.8.1997 / 16:35:45 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   854
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   855
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   856
contentsWasSaved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   857
    "return true, if the contents was saved (by a save action),
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   858
     false if not (or was modified again after the last save)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   859
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   860
    ^ contentsWasSaved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   861
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   862
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   863
contentsWasSaved:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   864
    contentsWasSaved := aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   865
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   866
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   867
defaultFileNameForFileDialog
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   868
    "return the default fileName to use for the save-box"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   869
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   870
    ^ defaultFileNameForFileDialog
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   871
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   872
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   873
defaultFileNameForFileDialog:aBaseName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   874
    "define the default fileName to use for the save-box"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   875
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   876
    defaultFileNameForFileDialog := aBaseName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   877
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   878
    "Created: 13.2.1997 / 18:29:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   879
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   880
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   881
directoryForFileDialog:aDirectory
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   882
    "define the default directory to use for save-box"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   883
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   884
    directoryForFileDialog := aDirectory
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   885
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   886
    "Modified: 13.2.1997 / 18:30:01 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   887
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   888
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   889
externalEncoding
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   890
    "return the encoding used when the contents is saved via the 'save / save as' dialog.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   891
     This is (currently only) passed down from the fileBrowser,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   892
     and required when  utf8/japanese/chinese/korean text is edited.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   893
     (encoding is something like #utf8 #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   894
     Notice: this only affects the external representation of the text."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   895
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   896
    ^ externalEncoding
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   897
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   898
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   899
externalEncoding:encodingSymOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   900
    "define how the contents should be encoded when saved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   901
     via the 'save / save as' dialog.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   902
     This is (currently only) passed down from the fileBrowser,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   903
     and required when  utf8/japanese/chinese/korean text is edited.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   904
     (encoding is something like #utf8 #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   905
     Notice: this only affects the external representation of the text."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   906
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   907
    externalEncoding := encodingSymOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   908
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   909
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   910
parenthesisSpecification
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   911
    "return the value of the instance variable 'parenthesisSpecification' (automatically generated)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   912
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   913
    ^ parenthesisSpecification
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   914
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   915
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   916
parenthesisSpecification:aDictionary
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   917
    "set the dictionary which specifies which characters are opening, which are closing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   918
     and which are ignored characters w.r.t. parenthesis matching.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   919
     See the classes initialize method for a useful value."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   920
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   921
    parenthesisSpecification := aDictionary
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   922
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   923
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   924
saveAction:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   925
    saveAction := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   926
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   927
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   928
searchBarActionBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   929
    ^ searchBarActionBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   930
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   931
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   932
searchBarActionBlock:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   933
    searchBarActionBlock := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   934
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   935
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   936
!TextView methodsFor:'accessing-behavior'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   937
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   938
isReadOnly
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   939
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   940
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   941
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   942
readOnly:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   943
    "for protocol compatibility with editTextViews,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   944
     but actually ignored"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   945
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   946
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   947
!TextView methodsFor:'accessing-contents'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   948
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   949
contents:newContents selected:selectedBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   950
    self contents:newContents.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   951
    selectedBoolean ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   952
	list size == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   953
	    self selectFromLine:1 col:1 toLine:1 col:(list at:1) size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   954
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   955
	    self selectAll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   956
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   957
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   958
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   959
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   960
     |w|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   961
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   962
     w := Workspace new open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   963
     w contents:'Hello world' selected:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   964
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   965
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   966
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   967
fromFile:aFileName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   968
    "take contents from a named file"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   969
    <resource: #obsolete>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   970
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   971
    self obsoleteMethodWarning.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   972
    ^ self loadTextFile:aFileName.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   973
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   974
    "Modified: / 25-10-2006 / 14:47:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   975
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   976
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   977
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   978
    "set the displayed contents (a collection of strings) with redraw.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   979
     Redefined since changing the contents implies deselect"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   980
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   981
    self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   982
    super list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   983
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   984
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   985
loadTextFile:aFileName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   986
    "take contents from a named file"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   987
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   988
    |f|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   989
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   990
    f := aFileName asFilename.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   991
    self directoryForFileDialog:(f directoryName).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   992
    self contents:(f contents)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   993
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   994
    "Created: / 25-10-2006 / 14:44:01 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   995
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   996
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   997
setContents:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   998
    "set the contents (either a string or a Collection of strings)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   999
     dont change the position (i.e. do not scroll) or the selection."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1000
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1001
    |selStartLine selStartCol selEndLine selEndCol selStyle|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1002
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1003
    selStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1004
    selStartCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1005
    selEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1006
    selEndCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1007
    selStyle := selectStyle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1008
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1009
    super setContents:something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1010
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1011
    selStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1012
	self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1013
	    selectFromLine:selStartLine col:selStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1014
	    toLine:selEndLine col:selEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1015
	selectStyle := selStyle
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1016
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1017
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1018
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1019
    "Modified: / 31.3.1998 / 23:33:21 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1020
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1021
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1022
setList:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1023
    "set the displayed contents (a collection of strings)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1024
     without redraw.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1025
     Redefined since changing contents implies deselect"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1026
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1027
    self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1028
    super setList:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1029
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1030
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1031
setupForFile:aFileName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1032
    "take contents from a named file"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1033
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1034
    |baseName|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1035
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1036
    self loadTextFile:aFileName.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1037
    aFileName notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1038
	baseName := aFileName asFilename baseName.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1039
	self topView label:baseName.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1040
	self defaultFileNameForFileDialog:baseName.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1041
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1042
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1043
    "Created: / 25-10-2006 / 14:47:13 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1044
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1045
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1046
text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1047
    "for ST80 compatibility"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1048
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1049
    ^ self contents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1050
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1051
    "Created: / 19.4.1998 / 12:53:10 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1052
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1053
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1054
wordAtLine:selectLine col:selectCol do:aFiveArgBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1055
    "find word boundaries, evaluate the block argument with those.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1056
     A helper for nextWord and selectWord functions."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1057
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1058
    |beginCol endCol endLine thisCharacter flag|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1059
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1060
    flag := #word.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1061
    beginCol := selectCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1062
    endCol := selectCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1063
    endLine := selectLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1064
    thisCharacter := self characterAtLine:selectLine col:beginCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1065
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1066
    beginCol := self findBeginOfWordAtLine:selectLine col:selectCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1067
    endCol := self findEndOfWordAtLine:selectLine col:selectCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1068
    endCol == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1069
	endLine := selectLine + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1070
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1071
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1072
    "is the initial character within a word ?"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1073
    (wordCheck value:thisCharacter) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1074
	"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1075
	 try to catch a blank ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1076
	"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1077
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1078
	WordSelectCatchesBlanks ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1079
	    ((beginCol == 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1080
	    or:[(self characterAtLine:selectLine col:(beginCol - 1))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1081
		 ~~ Character space]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1082
		((self characterAtLine:selectLine col:(endCol + 1))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1083
		  == Character space) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1084
		    endCol := endCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1085
		    flag := #wordRight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1086
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1087
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1088
		beginCol := beginCol - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1089
		flag := #wordLeft
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1090
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1091
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1092
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1093
    aFiveArgBlock value:selectLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1094
		  value:beginCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1095
		  value:endLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1096
		  value:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1097
		  value:flag
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1098
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1099
    "Modified: 18.3.1996 / 17:31:04 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1100
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1101
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1102
!TextView methodsFor:'accessing-look'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1103
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1104
selectionBackgroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1105
    "return the selection-background color."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1106
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1107
    ^ selectionBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1108
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1109
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1110
selectionForegroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1111
    "return the selection-foreground color."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1112
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1113
    ^ selectionFgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1114
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1115
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1116
selectionForegroundColor:color1 backgroundColor:color2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1117
    "set both the selection-foreground and cursor background colors.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1118
     The default is defined by the styleSheet;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1119
     typically black-on-green for color displays and white-on-black for b&w displays."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1120
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1121
    selectionFgColor := color1 onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1122
    selectionBgColor := color2 onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1123
    self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1124
	self invalidate
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1125
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1126
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1127
    "Modified: 29.5.1996 / 16:22:15 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1128
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1129
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1130
!TextView methodsFor:'accessing-mvc'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1131
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1132
on:aModel aspect:aspectSym list:listSym change:changeSym menu:menuSym initialSelection:initial
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1133
    "set all of model, aspect, listMessage, changeSymbol, menySymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1134
     and selection. Added for ST-80 compatibility"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1135
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1136
    aspectSym notNil ifTrue:[aspectMsg := aspectSym.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1137
			     listMsg isNil ifTrue:[listMsg := aspectSym]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1138
    changeSym notNil ifTrue:[changeMsg := changeSym].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1139
    listSym notNil ifTrue:[listMsg := listSym].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1140
    menuSym notNil ifTrue:[menuMsg := menuSym].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1141
"/    initial notNil ifTrue:[initialSelectionMsg := initial].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1142
    self model:aModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1143
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1144
    "Modified: 15.8.1996 / 12:52:54 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1145
    "Modified: 2.1.1997 / 16:11:28 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1146
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1147
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1148
!TextView methodsFor:'drag & drop'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1149
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1150
allowDrag:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1151
    "enable/disable dragging support
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1152
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1153
    aBoolean ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1154
	dropSource := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1155
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1156
	dropSource isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1157
	    dropSource := DropSource
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1158
			    receiver:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1159
			    argument:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1160
			    dropObjectSelector:#collectionOfDragObjects
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1161
			    displayObjectSelector:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1162
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1163
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1164
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1165
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1166
canDrag
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1167
    "returns true if dragging is enabled"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1168
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1169
    ^ dropSource notNil and:[ self hasSelection ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1170
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1171
    "Modified (comment): / 12-02-2012 / 08:37:21 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1172
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1173
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1174
collectionOfDragObjects
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1175
    "returns collection of dragable objects assigned to selection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1176
     Here, by default, a collection of text-dragObjects is generated;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1177
     however, if a dragObjectConverter is defined, that one gets a chance
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1178
     to convert as appropriate.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1179
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1180
    |selection|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1181
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1182
    selection := self selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1183
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1184
    selection size == 0 ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1185
  ^ Array with:(DropObject newText:selection).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1186
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1187
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1188
dropSource
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1189
    "returns the dropSource or nil"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1190
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1191
    ^ dropSource
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1192
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1193
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1194
dropSource:aDropSourceOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1195
    "set the dropSource or nil"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1196
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1197
    dropSource := aDropSourceOrNil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1198
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1199
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1200
!TextView methodsFor:'encoding'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1201
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1202
validateFontEncodingFor:newEncoding ask:ask
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1203
    "if required, query user if he/she wants to change to another font,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1204
     which is able to display text encoded as specified by newEncoding"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1205
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1206
    |fontsEncoding msg filter f defaultFont pref matchingFonts
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1207
     matchingFamilyFonts matchingFamilyFaceFonts matchingFamilyFaceStyleFonts
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1208
     matchingFamilyFaceStyleSizeFonts|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1209
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1210
    fontsEncoding := gc font encoding.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1211
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1212
    pref := FontDescription preferredFontEncodingFor:newEncoding.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1213
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1214
    (pref match:fontsEncoding) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1215
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1216
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1217
    (CharacterEncoder isEncoding:pref subSetOf:fontsEncoding) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1218
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1219
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1220
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1221
    filter := [:f | |coding|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1222
		    (coding := f encoding) notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1223
		    and:[pref match:coding]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1224
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1225
    self graphicsDevice flushListOfAvailableFonts.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1226
    matchingFonts := self graphicsDevice listOfAvailableFonts select:filter.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1227
    matchingFamilyFonts := matchingFonts select:[:f | f family = gc font family].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1228
    matchingFamilyFaceFonts := matchingFamilyFonts select:[:f | f face = gc font face].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1229
    matchingFamilyFaceStyleFonts := matchingFamilyFaceFonts select:[:f | f style = gc font style].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1230
    matchingFamilyFaceStyleSizeFonts := matchingFamilyFaceStyleFonts select:[:f | f size = gc font size].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1231
    matchingFamilyFaceStyleSizeFonts size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1232
	defaultFont := matchingFamilyFaceStyleSizeFonts first
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1233
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1234
	matchingFamilyFaceStyleFonts size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1235
	    defaultFont := matchingFamilyFaceStyleFonts first
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1236
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1237
	    matchingFamilyFaceFonts size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1238
		defaultFont := matchingFamilyFaceFonts first
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1239
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1240
		matchingFamilyFonts size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1241
		    defaultFont := matchingFamilyFonts first
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1242
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1243
		    matchingFonts size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1244
			defaultFont := matchingFonts first
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1245
		    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1246
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1247
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1248
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1249
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1250
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1251
    defaultFont isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1252
	defaultFont isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1253
	    self warn:'Your display does not seem to provide any ' , newEncoding allBold , ' encoded font.\\Please select an appropriate font (iso10646-Unicode recommended)'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1254
	    pref := #'iso10646-1'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1255
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1256
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1257
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1258
    msg := 'Switch to a %1 encoded font ?'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1259
    (ask not or:[self confirm:(resources stringWithCRs:msg with:pref)])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1260
    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1261
	self withWaitCursorDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1262
	    f := FontPanel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1263
		    fontFromUserInitial:defaultFont
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1264
		    title:(resources string:'Font selection')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1265
		    filter:filter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1266
		    encoding:pref.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1267
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1268
	    f notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1269
		self font:f.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1270
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1271
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1272
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1273
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1274
    "Created: 26.10.1996 / 12:06:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1275
    "Modified: 30.6.1997 / 17:46:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1276
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1277
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1278
!TextView methodsFor:'event handling'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1279
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1280
buttonMotion:buttonState x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1281
    "mouse-move while button was pressed - handle selection changes"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1282
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1283
    (clickLine isNil or:[clickPos isNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1284
	dragIsActive := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1285
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1286
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1287
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1288
    dragIsActive ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1289
	(clickPos dist:(x@y)) >= 5.0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1290
	    dragIsActive := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1291
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1292
	    self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1293
		dropSource startDragIn:self at:(x@y)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1294
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1295
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1296
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1297
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1298
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1299
    "is it the select or 1-button ?"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1300
    buttonState == 0 ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1301
    self sensor leftButtonPressed ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1302
	"/ self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1303
	"/ self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1304
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1305
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1306
"/    (device buttonMotionMask:buttonState includesButton:#select) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1307
"/        (device buttonMotionMask:buttonState includesButton:1) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1308
"/            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1309
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1310
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1311
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1312
    "if moved outside of view, start autoscroll"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1313
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1314
    ((y < 0) and:[firstLineShown ~~ 0]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1315
	self compressMotionEvents:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1316
	self startAutoScrollUp:y negated.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1317
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1318
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1319
    (y > height) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1320
	self compressMotionEvents:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1321
	self startAutoScrollDown:(y - height).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1322
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1323
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1324
    ((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1325
	self compressMotionEvents:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1326
	self startAutoScrollLeft:x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1327
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1328
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1329
    (x > width) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1330
	self compressMotionEvents:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1331
	self startAutoScrollRight:(x - width).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1332
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1333
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1334
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1335
    "move inside - stop autoscroll if any"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1336
    autoScrollBlock notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1337
	self stopScrollSelect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1338
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1339
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1340
    self extendSelectionToX:x y:y setPrimarySelection:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1341
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1342
    "Modified: / 08-08-2010 / 11:20:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1343
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1344
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1345
buttonMultiPress:button x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1346
    "multi-mouse-click - select word under pointer"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1347
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1348
    (button == 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1349
	clickPos := x @ y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1350
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1351
	"/ The searchAction is mantained until a cut/replace or a search with a user selection is done
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1352
"/        self clearSearchAction.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1353
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1354
	clickCount notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1355
	    clickCount := clickCount + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1356
	    (clickCount == 2) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1357
		self doubleClickX:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1358
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1359
		(clickCount == 3) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1360
		    self tripleClickX:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1361
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1362
		    (clickCount == 4) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1363
			self quadClickX:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1364
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1365
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1366
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1367
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1368
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1369
	super buttonMultiPress:button x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1370
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1371
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1372
    "Modified: 11.9.1997 / 04:15:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1373
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1374
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1375
buttonPress:button x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1376
    "mouse-click - prepare for selection change"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1377
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1378
    |sensor clickVisibleLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1379
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1380
    dragIsActive := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1381
    sensor       := self sensor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1382
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1383
    (button == 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1384
	sensor shiftDown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1385
	    "mouse-click with shift - adding to selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1386
	    self extendSelectionToX:x y:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1387
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1388
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1389
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1390
	clickVisibleLine := self visibleLineOfY:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1391
	clickPos := x @ y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1392
	clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1393
	clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1394
	clickStartLine := clickLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1395
	clickStartCol := clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1396
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1397
	(self canDrag
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1398
	and:[(self isInSelection:clickLine col:clickCol)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1399
	and:[UserPreferences current startTextDragWithControl not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1400
	     or:[sensor ctrlDown]]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1401
	    dragIsActive := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1402
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1403
	    self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1404
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1405
	clickCount := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1406
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1407
	super buttonPress:button x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1408
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1409
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1410
    "Modified: / 20.5.1999 / 17:02:45 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1411
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1412
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1413
buttonRelease:button x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1414
    "mouse- button release - turn off autoScroll if any"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1415
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1416
    (button == 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1417
	self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1418
	    self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1419
	    self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1420
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1421
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1422
	autoScrollBlock notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1423
	    self stopScrollSelect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1424
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1425
	dragIsActive ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1426
	    self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1427
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1428
	clickPos := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1429
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1430
	super buttonRelease:button x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1431
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1432
    dragIsActive := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1433
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1434
    "/ clickPos := clickLine := clickCol := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1435
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1436
    "Modified: / 20.5.1999 / 17:14:23 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1437
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1438
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1439
doubleClickX:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1440
    "double-click - select word under pointer"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1441
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1442
    |sel ch scanCh matchCol scanCol fwdScan fwdSelect|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1443
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1444
    self selectWordAtX:x y:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1445
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1446
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1447
     special - if clicked on a parenthesis, select to matching
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1448
     (must de before doing the ST80 stuff below)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1449
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1450
    ((sel := self selection) size == 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1451
    and:[(sel := sel at:1) size == 1]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1452
	ch := sel at:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1453
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1454
	((self isOpeningParenthesis:ch)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1455
	or:[ (self isClosingParenthesis:ch) ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1456
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1457
		searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1458
		ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1459
			      |prevLine prevCol moveBack pos1|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1460
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1461
			      prevLine := firstLineShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1462
			      prevCol := viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1463
			      self selectFromLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1464
					   toLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1465
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1466
			      self sensor ctrlDown ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1467
				  "/ undo scroll operation ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1468
				  self withCursor:Cursor eye do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1469
				      |delayCount|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1470
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1471
				      moveBack := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1472
				      (self isClosingParenthesis:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1473
					   (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1474
					       moveBack := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1475
					   ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1476
				      ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1477
					   selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1478
					       self makeLineVisible:selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1479
					       moveBack := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1480
					   ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1481
				      ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1482
				      moveBack ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1483
					   delayCount  := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1484
					   pos1 := x@y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1485
					   self invalidateRepairNow:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1486
					   Delay waitForSeconds:MatchDelayTime.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1487
					   delayCount := delayCount + MatchDelayTime.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1488
					   [self sensor hasUserEventFor:self] whileFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1489
						Delay waitForSeconds:MatchDelayTime / 2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1490
						delayCount := delayCount + (MatchDelayTime / 2).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1491
						delayCount > 2 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1492
						    self cursor:Cursor eyeClosed.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1493
						].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1494
						delayCount >= 2.3 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1495
						    self cursor:Cursor eye.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1496
						    delayCount := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1497
						]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1498
					   ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1499
					   self scrollToLine:prevLine; scrollToCol:prevCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1500
				      ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1501
				  ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1502
			      ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1503
			      ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1504
			  ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1505
		ifNotFound:[self showNotFound]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1506
		onError:[self beep]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1507
		openingCharacters:((parenthesisSpecification at:#open) ", '([{'")
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1508
		closingCharacters:((parenthesisSpecification at:#close) ", ')]}'").
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1509
	    selectStyle := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1510
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1511
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1512
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1513
    (self st80SelectMode or:[ self sensor ctrlDown]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1514
	"/ st80 selects:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1515
	"/   - if clicked right after a parenthesis -> select to matching parenthesis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1516
	"/   - if clicked right after a quote -> select to matching quote (unless escaped ;-)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1517
	"/   - if clicked at beginning of the line  -> select that line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1518
	"/   - if clicked at the top of the text    -> select all
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1519
	"/ however, do none of the above, if clicked on a parenthesis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1520
	clickCol == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1521
	    clickLine == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1522
		self selectAll.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1523
		^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1524
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1525
	    self selectLineAtY:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1526
	    selectStyle := #line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1527
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1528
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1529
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1530
	matchCol := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1531
	"/ see what is to the left of that character ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1532
	clickCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1533
	    ch := self characterAtLine:clickLine col:clickCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1534
	    (self isOpeningParenthesis:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1535
		matchCol := clickCol - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1536
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1537
		('"''|' includes:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1538
		    scanCol := clickCol - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1539
		    fwdScan := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1540
		    scanCh := ch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1541
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1542
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1543
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1544
	fwdSelect := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1545
	(matchCol isNil and:[scanCol isNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1546
	    clickCol < (self listAt:clickLine) size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1547
		ch := self characterAtLine:clickLine col:clickCol+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1548
		(self isClosingParenthesis:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1549
		    matchCol := clickCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1550
		    fwdSelect := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1551
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1552
		    ('"''|' includes:ch) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1553
			scanCol := clickCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1554
			fwdScan := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1555
			scanCh := ch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1556
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1557
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1558
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1559
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1560
	matchCol notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1561
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1562
		searchForMatchingParenthesisFromLine:clickLine col:matchCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1563
		ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1564
			  self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1565
				       toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1566
		ifNotFound:[self showNotFound]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1567
		onError:[self beep]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1568
		openingCharacters:((parenthesisSpecification at:#open) , '([{')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1569
		closingCharacters:((parenthesisSpecification at:#close) , ')]}').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1570
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1571
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1572
	scanCol notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1573
	    "/ if its an EOL comment, do it differently
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1574
	    ch := self characterAtLine:clickLine col:clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1575
	    ch == $/ ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1576
		self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1577
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1578
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1579
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1580
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1581
		scanFor:scanCh fromLine:clickLine col:scanCol forward:fwdScan
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1582
		ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1583
			    |selStart selEnd|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1584
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1585
			    fwdScan ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1586
				selStart := scanCol+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1587
				selEnd := col-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1588
			    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1589
				selStart := scanCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1590
				selEnd := col+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1591
			    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1592
			    self selectFromLine:clickLine col:selStart
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1593
				 toLine:line col:selEnd.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1594
			    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1595
			   ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1596
		ifNotFound:[self showNotFound].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1597
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1598
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1599
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1600
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1601
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1602
     remember words position in case of a drag following
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1603
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1604
    wordStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1605
    wordEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1606
    selectStyle == #wordLeft ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1607
	wordStartCol := selectionStartCol + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1608
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1609
	wordStartCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1610
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1611
    selectStyle == #wordRight ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1612
	wordEndCol := selectionEndCol - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1613
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1614
	wordEndCol := selectionEndCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1615
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1616
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1617
    "Created: / 11-09-1997 / 04:12:55 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1618
    "Modified: / 14-06-2011 / 14:04:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1619
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1620
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1621
extendSelectionToX:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1622
    "mouse-move while button was pressed - handle selection changes"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1623
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1624
    self extendSelectionToX:x y:y setPrimarySelection:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1625
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1626
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1627
extendSelectionToX:x y:y setPrimarySelection:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1628
    "mouse-move while button was pressed - handle selection changes"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1629
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1630
    |movedVisibleLine movedLine movedCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1631
     movedUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1632
     oldStartLine oldEndLine oldStartCol oldEndCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1633
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1634
    movedVisibleLine := self visibleLineOfY:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1635
    movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1636
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1637
    (x < leftMargin) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1638
	movedCol := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1639
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1640
	movedCol := self colOfX:x inVisibleLine:movedVisibleLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1641
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1642
    y < 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1643
	movedCol := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1644
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1645
    ((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1646
	selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1647
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1648
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1649
	(clickPos isNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1650
	or:[(clickPos x - x) abs < 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1651
	    and:[(clickPos y - y) abs < 3]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1652
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1653
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1654
	selectionStartLine := clickLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1655
	selectionStartCol := clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1656
	selectionEndLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1657
	selectionEndCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1658
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1659
	oldStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1660
	oldEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1661
	oldStartCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1662
	oldEndCol := selectionEndCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1663
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1664
	selectionStartLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1665
	    selectionStartLine := selectionEndLine := clickLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1666
	    selectionStartCol := selectionEndCol := clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1667
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1668
	oldStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1669
	oldEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1670
	oldStartCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1671
	oldEndCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1672
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1673
    oldEndLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1674
	oldEndLine := selectionEndLine ? clickLine ? movedLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1675
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1676
    oldEndCol isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1677
	oldEndCol := selectionEndCol ? clickCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1678
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1679
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1680
    "find out if we are before or after initial click"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1681
    movedUp := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1682
    clickStartLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1683
	clickStartLine := movedLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1684
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1685
    clickStartCol isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1686
	clickStartCol := movedCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1687
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1688
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1689
    (movedLine < clickStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1690
	movedUp := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1691
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1692
	(movedLine == clickStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1693
	    (movedCol < clickStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1694
		movedUp := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1695
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1696
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1697
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1698
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1699
    movedUp ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1700
	"change selectionStart"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1701
	selectionStartCol := movedCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1702
	selectionStartLine := movedLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1703
	selectionEndCol := clickStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1704
	selectionEndLine := clickStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1705
	selectStyle notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1706
	    selectionEndCol := wordEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1707
	    selectionEndLine := wordEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1708
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1709
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1710
	"change selectionEnd"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1711
	selectionEndCol := movedCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1712
	selectionEndLine := movedLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1713
	selectionStartCol := clickStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1714
	selectionStartLine := clickStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1715
	selectStyle notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1716
	    selectionStartCol := wordStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1717
	    selectionStartLine := wordStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1718
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1719
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1720
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1721
    selectionStartLine isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1722
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1723
    (selectionStartCol == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1724
	selectionStartCol := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1725
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1726
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1727
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1728
     if in word-select, just catch the rest of the word
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1729
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1730
    (selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1731
	movedUp ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1732
	    selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1733
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1734
	    selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1735
	    selectionEndCol == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1736
		selectionEndLine := selectionEndLine + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1737
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1738
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1739
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1740
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1741
    selectStyle == #line ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1742
	movedUp ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1743
	    selectionStartCol := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1744
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1745
	    selectionEndCol := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1746
	    selectionEndLine := selectionEndLine + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1747
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1748
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1749
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1750
    self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1751
    aBoolean ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1752
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1753
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1754
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1755
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1756
    "/ The searchAction is mantained until a cut/replace or a search with a user selection is done
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1757
"/    self clearSearchAction.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1758
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1759
    (oldStartLine == selectionStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1760
	(oldStartCol ~~ selectionStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1761
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1762
		redrawLine:oldStartLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1763
		      from:((selectionStartCol min:oldStartCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1764
			to:((selectionStartCol max:oldStartCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1765
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1766
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1767
	self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1768
	    redrawFromLine:(oldStartLine?selectionStartLine min:selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1769
			to:(oldStartLine?selectionStartLine max:selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1770
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1771
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1772
    (oldEndLine == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1773
	(oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1774
	    self redrawLine:oldEndLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1775
		       from:((selectionEndCol min:oldEndCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1776
			 to:((selectionEndCol max:oldEndCol) max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1777
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1778
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1779
	selectionEndLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1780
	    selectionStartLine := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1781
	    self redraw.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1782
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1783
	    (selectionStartLine notNil) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1784
		self redrawFromLine:(oldEndLine min:selectionEndLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1785
				 to:(oldEndLine max:selectionEndLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1786
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1787
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1788
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1789
    clickLine := movedLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1790
    clickCol := movedCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1791
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1792
    "Modified: / 05-04-2011 / 17:13:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1793
    "Modified: / 17-04-2012 / 21:00:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1794
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1795
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1796
keyPress:key x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1797
    "handle some keyboard input (there is not much to be done here)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1798
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1799
    <resource: #keyboard (#Find #Copy #FindNext #FindPrev #FindAgain
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1800
			  #GotoLine #SelectAll #SaveAs #Print
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1801
			  #'F*' #'f*' #ZoomIn #ZoomOut)>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1802
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1803
    (key == #Find) ifTrue:[self search. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1804
    (key == #Copy) ifTrue:[self copySelection. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1805
    (key == #GotoLine) ifTrue:[self gotoLine. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1806
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1807
    (key == #FindNext) ifTrue:[self searchFwd. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1808
    (key == #FindPrev) ifTrue:[self searchBwd. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1809
    (key == #FindAgain) ifTrue:[self searchAgainInSameDirection. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1810
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1811
    (key == #SelectAll) ifTrue:[self selectAll. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1812
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1813
    (key == #SaveAs)    ifTrue:[self save.    ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1814
    (key == #Print)     ifTrue:[self doPrint. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1815
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1816
    (key == #ZoomIn or:[key == #ZoomOut]) ifTrue:[ self fontLargerOrSmaller:(key == #ZoomIn) ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1817
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1818
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1819
     shift-Fn defines a key-sequence
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1820
     Fn       pastes that sequence
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1821
     cmd-Fn   performs a 'doIt' on the sequence (Workspaces only)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1822
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1823
     (see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1824
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1825
    (key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1826
	(('[fF][0-9]' match:key)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1827
	or:['[fF][0-9][0-9]' match:key]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1828
	    self sensor shiftDown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1829
		UserPreferences current functionKeySequences
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1830
		    at:key put:(self selection)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1831
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1832
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1833
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1834
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1835
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1836
    super keyPress:key x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1837
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1838
    "Modified: / 18-04-1997 / 12:12:27 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1839
    "Modified: / 10-03-2012 / 09:40:01 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1840
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1841
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1842
mapped
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1843
    super mapped.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1844
    selectionFgColor := selectionFgColor onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1845
    selectionBgColor := selectionBgColor onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1846
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1847
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1848
quadClickX:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1849
    "quadrupleClick-click - select all"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1850
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1851
    self selectAll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1852
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1853
    "Created: / 11.9.1997 / 04:15:24 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1854
    "Modified: / 31.3.1998 / 14:21:13 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1855
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1856
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1857
tripleClickX:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1858
    "triple-click - select line under pointer"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1859
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1860
    self selectLineAtY:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1861
    selectStyle := #line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1862
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1863
    "Created: 11.9.1997 / 04:13:37 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1864
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1865
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1866
!TextView methodsFor:'initialization & release'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1867
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1868
fetchDeviceResources
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1869
    "fetch device colors, to avoid reallocation at redraw time"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1870
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1871
    super fetchDeviceResources.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1872
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1873
    selectionFgColor notNil ifTrue:[selectionFgColor := selectionFgColor onDevice:self graphicsDevice].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1874
    selectionBgColor notNil ifTrue:[selectionBgColor := selectionBgColor onDevice:self graphicsDevice].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1875
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1876
    "Created: 14.1.1997 / 00:14:33 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1877
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1878
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1879
initStyle
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1880
    "setup viewStyle specifics"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1881
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1882
    super initStyle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1883
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1884
    viewBackground := DefaultViewBackground.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1885
    selectionFgColor := DefaultSelectionForegroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1886
    selectionFgColor isNil ifTrue:[selectionFgColor := bgColor].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1887
    selectionBgColor := DefaultSelectionBackgroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1888
    selectionBgColor isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1889
	self graphicsDevice hasColors ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1890
	    DefaultSelectionForegroundColor isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1891
		selectionFgColor := fgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1892
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1893
	    selectionBgColor := Color green
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1894
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1895
	    self graphicsDevice hasGrayscales ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1896
		DefaultSelectionForegroundColor isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1897
		    selectionFgColor := fgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1898
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1899
		selectionBgColor := Color grey
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1900
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1901
		selectionBgColor := fgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1902
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1903
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1904
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1905
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1906
    "Modified: / 22-01-1997 / 11:57:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1907
    "Modified (comment): / 05-10-2011 / 15:50:45 / az"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1908
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1909
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1910
initialize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1911
    super initialize.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1912
    self initializeSaveAction.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1913
    contentsWasSaved := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1914
    dragIsActive     := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1915
    lastSearchWasMatch := lastSearchWasVariableSearch := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1916
    lastSearchIgnoredCase := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1917
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1918
    parenthesisSpecification isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1919
	parenthesisSpecification := DefaultParenthesisSpecification.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1920
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1921
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1922
    "I handle menus myself"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1923
    menuHolder := menuPerformer := self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1924
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1925
    "/ on default allow drag
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1926
    self allowDrag:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1927
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1928
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1929
initializeSaveAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1930
    saveAction := [ self openSaveDialog ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1931
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1932
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1933
!TextView methodsFor:'menu & menu actions'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1934
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1935
appendTo:aFileName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1936
    "append contents to a file named fileName"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1937
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1938
    |aStream msg filename|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1939
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1940
    filename := aFileName asFilename.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1941
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1942
    (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1943
	msg := resources string:'Refused to append to file ''%1'' !!' with:filename name.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1944
	self warn:(msg , '\\(ST/X internal permission check)' ) withCRs.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1945
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1946
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1947
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1948
    [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1949
	aStream := filename appendingWriteStream.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1950
	[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1951
	    self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1952
	] ensure:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1953
	    aStream close.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1954
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1955
	contentsWasSaved := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1956
    ] on:FileStream openErrorSignal do:[:ex|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1957
	msg := resources string:'cannot append to file %1 !!' with:filename name.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1958
	self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1959
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1960
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1961
    "Modified: / 27-07-2012 / 09:41:18 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1962
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1963
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1964
changeFont
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1965
    "pop up a fontPanel to change font"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1966
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1967
    |newFont|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1968
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1969
    self withWaitCursorDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1970
	newFont := FontPanel fontFromUserInitial:gc font.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1971
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1972
    newFont notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1973
	self font:newFont.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1974
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1975
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1976
    "Modified: 27.2.1996 / 00:53:51 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1977
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1978
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1979
copySelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1980
    "copy contents into smalltalk copybuffer"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1981
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1982
    |text|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1983
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1984
    text := self selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1985
    text notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1986
	self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1987
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1988
	"/ forget any emphasis ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1989
	text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1990
	self setClipboardText:text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1991
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1992
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1993
    "Modified: 17.5.1996 / 08:57:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1994
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1995
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1996
defaultForGotoLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1997
    "return a default value to show in the gotoLine box"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1998
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1999
    ^ selectionStartLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2000
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2001
    "Modified: 1.3.1996 / 18:44:36 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2002
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2003
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2004
doPrint
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2005
    "print the contents on the printer"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2006
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2007
    |printStream|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2008
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2009
    list isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2010
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2011
    self withWaitCursorDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2012
	printStream := Printer new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2013
	printStream supportsContext ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2014
	    printStream printerContext font:(self font).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2015
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2016
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2017
	Printer writeErrorSignal handle:[:ex |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2018
	    self warn:('error while printing:\\'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2019
			, ex description
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2020
			, '\\(printing with: ' , (Printer printCommand) , ')') withCRs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2021
	] do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2022
	    self fileOutContentsOn:printStream.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2023
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2024
	printStream close
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2025
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2026
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2027
    "Created: / 06-05-1996 / 16:11:26 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2028
    "Modified: / 31-01-2012 / 18:16:39 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2029
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2030
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2031
editMenu
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2032
    "return my popUpMenu"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2033
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2034
    <resource: #keyboard (#Copy #Find #GotoLine #SaveAs #Print)>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2035
    <resource: #programMenu>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2036
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2037
    |items m|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2038
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2039
    items := #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2040
			('Copy'          copySelection  Copy)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2041
			('-'             nil            )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2042
			('Search...'     search         Find)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2043
			('Goto Line...'  gotoLine       GotoLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2044
			('-'             nil            )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2045
			('Font...'       changeFont     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2046
			('-'             nil            )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2047
			('Save As...'    save           SaveAs)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2048
			('Print'         doPrint        Print)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2049
		).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2050
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2051
    m := PopUpMenu itemList:items resources:resources.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2052
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2053
    self hasSelectionForCopy ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2054
	m disable:#copySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2055
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2056
    ^ m
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2057
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2058
    "Modified: / 12.11.2001 / 13:43:56 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2059
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2060
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2061
find
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2062
    "same as search - for VW compatibility"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2063
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2064
    self search
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2065
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2066
    "Created: 31.7.1997 / 19:13:58 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2067
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2068
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2069
fontLargerOrSmaller:largerBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2070
    |newFont|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2071
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2072
    newFont := gc font asSize:(largerBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2073
			    ifTrue:[gc font size + 1]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2074
			    ifFalse:[(gc font size-1) max:4]).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2075
    self font:newFont.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2076
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2077
    "Modified: / 27-02-1996 / 00:53:51 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2078
    "Created: / 10-03-2012 / 09:38:32 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2079
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2080
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2081
gotoLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2082
    "show a box to enter lineNumber for positioning;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2083
     The entered number may be prefixed by a + or -;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2084
     in this case, the linenumber is taken relative to the current position."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2085
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2086
    |l lineNumberBox input lineToGo relative|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2087
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2088
    lineNumberBox :=
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2089
	EnterBox
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2090
	   title:(resources string:'Line number (or +/- relativeNr):')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2091
	   okText:(resources string:'Goto')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2092
	   abortText:(resources string:'Cancel')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2093
	   action:[:l | input := l].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2094
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2095
    l := self defaultForGotoLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2096
    l notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2097
	l := l printString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2098
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2099
    lineNumberBox initialText:l .
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2100
    lineNumberBox label:(resources string:'Goto Line').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2101
    lineNumberBox showAtPointer.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2102
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2103
    input size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2104
	input := input withoutSpaces.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2105
	input size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2106
	    (input startsWith:$+) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2107
		relative := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2108
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2109
		(input startsWith:$-) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2110
		    relative := -1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2111
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2112
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2113
	    relative notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2114
		input := input copyFrom:2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2115
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2116
	    lineToGo := Integer readFromString:input onError:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2117
	    lineToGo notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2118
		relative notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2119
		    lineToGo := self currentLine + (lineToGo * relative)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2120
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2121
		self gotoLine:lineToGo
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2122
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2123
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2124
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2125
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2126
    "Modified: / 17.5.1998 / 20:07:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2127
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2128
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2129
openSaveDialog
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2130
    "Ask user for filename using a fileSelectionBox
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2131
     and save contents into that file."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2132
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2133
    Dialog
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2134
	requestSaveFileName:(resources string:'Save contents in:')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2135
	default:defaultFileNameForFileDialog
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2136
	fromDirectory:directoryForFileDialog
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2137
	action:[:fileName | self saveAs:fileName]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2138
	appendAction:[:fileName | self appendTo:fileName]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2139
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2140
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2141
openSearchBoxAndSearch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2142
    "search for a string - show a box to enter searchpattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2143
     - currently no regular expressions are handled."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2144
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2145
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2146
     Q: is it a good idea to preserve the last searchstring between views?
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2147
     cg: yes - turns out to be useful and less confusing than keeping last per view
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2148
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2149
    |searchBox patternHolder caseHolder matchHolder fwd ign match initialString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2150
     bindings bldr doSearch modal searchVariableHolder selectedVariable searchFullWordHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2151
     replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2152
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2153
    searchBarActionBlock notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2154
	self resetVariablesBeforeNewSearch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2155
	searchBarActionBlock value:#search value:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2156
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2157
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2158
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2159
    modal := (UserPreferences current searchDialogIsModal).   "/ thats experimental
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2160
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2161
    ign := lastSearchIgnoredCase "? LastSearchIgnoredCase " ? true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2162
    caseHolder := ign not asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2163
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2164
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2165
    matchHolder := match asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2166
    searchVariableHolder := (lastSearchWasVariableSearch ? false) asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2167
    searchFullWordHolder := false asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2168
    replaceBooleanHolder := false asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2169
    replaceTextHolder := '' asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2170
    replaceBooleanEnabledHolder := self isReadOnly not asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2171
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2172
    patternHolder := '' asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2173
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2174
    self setSearchPatternWithMatchEscapes: match.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2175
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2176
    lastSearchPattern notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2177
	initialString := lastSearchPattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2178
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2179
"/  No longer force the current selection to be the initialString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2180
"/    self hasSelectionWithinSingleLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2181
"/        initialString := self selection asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2182
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2183
    initialString isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2184
	LastSearchPatterns size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2185
	    initialString := LastSearchPatterns first.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2186
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2187
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2188
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2189
    initialString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2190
	patternHolder value:initialString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2191
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2192
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2193
    fwd := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2194
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2195
    doSearch := [:fwd |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2196
	|isVariableSearch pattern searchAction|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2197
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2198
	self resetVariablesBeforeNewSearch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2199
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2200
	isVariableSearch := self searchVariableVisible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2201
				and:[searchVariableHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2202
				and:[selectedVariable notNil]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2203
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2204
	isVariableSearch ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2205
	    searchAction := [self searchVariableWithSyntaxElement:selectedVariable forward:fwd].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2206
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2207
	    lastSearchWasVariableSearch := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2208
	    LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2209
	    LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2210
	    pattern := patternHolder value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2211
	    pattern notEmptyOrNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2212
		searchAction := [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2213
		    self searchUsingSpec:(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2214
			ListView::SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2215
			    pattern:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2216
			    ignoreCase:lastSearchIgnoredCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2217
			    match: lastSearchWasMatch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2218
			    variable: searchVariableHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2219
			    fullWord: searchFullWordHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2220
			    forward:fwd).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2221
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2222
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2223
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2224
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2225
	replaceBooleanHolder value ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2226
	    |selStart|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2227
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2228
	    isVariableSearch ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2229
		"/ must replace from the end towards beginning,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2230
		"/ because syntax-elements do not update their position, when
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2231
		"/ the text is changed (in replace).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2232
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2233
		selectedVariable := selectedVariable lastElementInChain.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2234
		self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2235
		searchAction := [selectedVariable := selectedVariable previousElement.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2236
				 selectedVariable notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2237
				     self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2238
				 ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2239
				 "/ self searchVariableWithSyntaxElement:selectedVariable forward:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2240
				].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2241
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2242
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2243
	    selStart := self characterPositionOfSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2244
	    self replace:(replaceTextHolder value).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2245
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2246
	    searchAction value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2247
	    [self characterPositionOfSelection ~= selStart] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2248
		selStart := self characterPositionOfSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2249
		self replace:(replaceTextHolder value).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2250
		searchAction value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2251
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2252
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2253
	    searchAction value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2254
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2255
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2256
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2257
    bindings := IdentityDictionary new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2258
    bindings at:#searchPattern put:patternHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2259
    modal ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2260
	bindings at:#nextAction put:[searchBox doAccept.].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2261
	bindings at:#prevAction put:[fwd := false. searchBox doAccept.].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2262
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2263
	bindings at:#nextAction put:[doSearch value:true.  "searchBox doAccept."].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2264
	bindings at:#prevAction put:[doSearch value:false. "fwd := false. searchBox doAccept."].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2265
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2266
    bindings at:#caseSensitive put:caseHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2267
    bindings at:#match put:matchHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2268
    bindings at:#patternList put:LastSearchPatterns.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2269
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2270
    self supportsSyntaxElements ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2271
	bindings at:#searchVariableVisible put:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2272
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2273
	bindings at:#searchVariableVisible put:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2274
	selectedVariable := self syntaxElementForSelectedVariable.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2275
	bindings at:#searchVariableEnabled put:(selectedVariable notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2276
	selectedVariable notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2277
	    bindings
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2278
		at:#stringWithVariableUnderCursorHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2279
		put:('Variable ("%1")' bindWith:selectedVariable value).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2280
	    searchVariableHolder value:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2281
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2282
	    bindings
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2283
		at:#stringWithVariableUnderCursorHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2284
		put:('Variable (none selected)').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2285
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2286
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2287
    bindings at:#searchVariable put:searchVariableHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2288
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2289
    bindings at:#searchFullWord put:searchFullWordHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2290
    bindings at:#searchFullWordEnabled put:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2291
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2292
    bindings at:#replaceEnabled put:replaceBooleanEnabledHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2293
    bindings at:#replaceBoolean put:replaceBooleanHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2294
    bindings at:#replaceTextHolder put:replaceTextHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2295
    replaceBooleanHolder onChangeEvaluate:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2296
	[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2297
	    replaceBooleanHolder value ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2298
		(bldr componentAt:#ReplaceEntryField) requestFocus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2299
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2300
		(bldr componentAt:#patternComboBox) requestFocus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2301
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2302
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2303
    modal ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2304
	searchBox := SimpleDialog new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2305
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2306
	searchBox := ApplicationModel new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2307
	searchBox createBuilder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2308
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2309
    searchBox resources:(self resources).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2310
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2311
    bldr := searchBox builder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2312
    bldr addBindings:bindings.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2313
    bldr aspectAt:#flyByHelpSpec put:(self class flyByHelpSpec).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2314
    searchBox allButOpenFrom:(self class searchDialogSpec).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2315
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2316
    (bldr componentAt:#nextButton) cursor:(Cursor thumbsUp).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2317
    (bldr componentAt:#prevButton) cursor:(Cursor thumbsUp).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2318
    (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2319
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2320
    modal ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2321
	searchBox openDialog.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2322
	searchBox accepted ifTrue:[ doSearch value:fwd ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2323
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2324
	(bldr componentAt:#nextButton) isReturnButton:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2325
	(bldr componentAt:#cancelButton)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2326
		label:(resources string:'Close');
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2327
		action:[searchBox closeRequest].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2328
	"/ searchBox masterApplication:self application.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2329
	self topView beMaster.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2330
	searchBox window
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2331
		beSlave;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2332
		openInGroup:(self windowGroup).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2333
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2334
	"/ searchBox window open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2335
	searchBox window assignKeyboardFocusToFirstInputField.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2336
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2337
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2338
    "Modified: / 11-07-2006 / 11:18:38 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2339
    "Created: / 08-03-2012 / 14:02:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2340
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2341
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2342
save
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2343
    "save contents into a file
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2344
     - ask user for filename using a fileSelectionBox."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2345
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2346
    saveAction value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2347
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2348
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2349
saveAs:fileName
5118
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2350
    "save the contents into a file named fileName.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2351
     On error return false otherwise return true"
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2352
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2353
    ^ self saveAs:fileName doAppend:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2354
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2355
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2356
saveAs:aFilename doAppend:doAppend
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2357
    "save the contents into a file named fileName;
5118
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2358
     if doAppend is true, the view's contents is appended to the existing
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2359
     contents - otherwise, it overwrites any previous file contents.
5118
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2360
     On error return false otherwise return true"
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2361
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2362
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2363
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2364
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2365
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2366
    "save the contents into a file named fileName;
5118
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2367
     if doAppend is true, the view's contents is appended to the existing
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2368
     contents - otherwise, it overwrites any previous file contents.
5118
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2369
     On error return false otherwise return true"
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2370
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2371
    ^ self saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:nil
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2372
!
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2373
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2374
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs eolMode:eolMode
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2375
    "save the contents into a file named fileName;
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2376
     if doAppend is true, the view's contents is appended to the existing
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2377
     contents - otherwise, it overwrites any previous file contents.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2378
     eolMode is one of #cr, #nl or #crlf.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2379
     On error return false otherwise return true."
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2380
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2381
    |filename msg|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2382
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2383
    filename := aFilename asFilename.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2384
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2385
    self withWriteCursorDo:[
5118
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2386
        |aStream|
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2387
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2388
        (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2389
            msg := resources 
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2390
                        stringWithCRs:'Refused to write file ''%1'' !!\(ST/X internal permission check)'
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2391
                        with:filename name.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2392
        ] ifTrue:[
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2393
            [
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2394
                doAppend ifTrue:[
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2395
                    aStream := filename appendingWriteStream.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2396
                ] ifFalse:[
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2397
                    aStream := filename newReadWriteStream.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2398
                ].
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2399
                aStream eolMode:eolMode.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2400
                self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2401
                aStream syncData; close.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2402
                contentsWasSaved := true.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2403
                defaultFileNameForFileDialog := filename.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2404
            ] on:FileStream openErrorSignal do:[:ex|
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2405
                msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)'
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2406
                                with:filename name
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2407
                                with:FileStream lastErrorString.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2408
            ].
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2409
        ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2410
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2411
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2412
    msg notNil ifTrue:[
5118
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2413
        Dialog warn:msg.
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2414
        ^ false
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2415
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2416
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2417
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2418
    "Modified: / 27-07-2012 / 09:45:13 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2419
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2420
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2421
search
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2422
    "search for a string - show a box to enter searchpattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2423
     - currently no regular expressions are handled."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2424
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2425
    self openSearchBoxAndSearch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2426
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2427
    "Modified: / 11-07-2006 / 11:18:38 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2428
    "Modified: / 08-03-2012 / 14:03:10 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2429
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2430
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2431
search:patternArg ignoreCase:ign forward:fwd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2432
    "search for a string without matching"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2433
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2434
    self search:patternArg ignoreCase:ign match: false forward:fwd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2435
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2436
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2437
search:patternArg ignoreCase:ign match: match forward:fwd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2438
    |pattern|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2439
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2440
    pattern := patternArg string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2441
    pattern notEmpty ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2442
	self rememberSearchPattern:pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2443
	"/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2444
	"/ LastSearchWasMatch := match.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2445
	fwd ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2446
	    lastSearchDirection := #backward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2447
	    self searchBwd:pattern ignoreCase:ign match: match.          "    backward search with match is not yet available  "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2448
	] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2449
	    lastSearchDirection := #forward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2450
	    self searchFwd:pattern ignoreCase:ign match: match.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2451
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2452
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2453
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2454
    "Created: / 11-07-2006 / 11:18:04 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2455
    "Modified: / 23-03-2012 / 12:12:07 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2456
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2457
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2458
searchUsingSpec:aSearchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2459
    self rememberSearchPattern:(aSearchSpec pattern).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2460
    "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2461
    "/ LastSearchWasMatch := match.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2462
    aSearchSpec forward ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2463
	lastSearchDirection := #backward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2464
	self searchBwdUsingSpec:aSearchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2465
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2466
	lastSearchDirection := #forward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2467
	self searchFwdUsingSpec:aSearchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2468
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2469
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2470
    "Created: / 11-07-2006 / 11:18:04 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2471
    "Modified: / 23-03-2012 / 12:12:07 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2472
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2473
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2474
searchVariableVisible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2475
    "search variable option in searchbox visible?
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2476
     (only true for codeview2's textview)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2477
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2478
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2479
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2480
    "Created: / 08-03-2012 / 14:01:24 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2481
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2482
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2483
searchVariableWithSyntaxElement:syntaxElementForVariable forward:fwd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2484
    "this only works for CodeView2::TextView, which supports syntaxElements.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2485
     Finds the next occurrence of a syntax element (typically, a variable)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2486
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2487
    |el el2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2488
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2489
    lastSearchWasVariableSearch := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2490
    el := fwd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2491
	ifTrue:[syntaxElementForVariable nextElement]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2492
	ifFalse:[syntaxElementForVariable previousElement].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2493
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2494
    el notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2495
	"bug workaround"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2496
	(el start = syntaxElementForVariable start) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2497
	    el2 := fwd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2498
		ifTrue:[el nextElement]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2499
		ifFalse:[el previousElement].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2500
	    el2 notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2501
		el := el2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2502
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2503
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2504
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2505
    el notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2506
	self selectFromCharacterPosition:el start to:el stop.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2507
	self makeLineVisible:(self lineOfCharacterPosition:el start).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2508
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2509
	self showNotFound
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2510
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2511
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2512
    "Created: / 08-03-2012 / 14:08:20 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2513
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2514
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2515
syntaxElementForSelectedVariable
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2516
    "for a better search; ignored here, but redefined in CodeView2"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2517
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2518
    ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2519
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2520
    "Created: / 08-03-2012 / 14:20:27 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2521
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2522
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2523
syntaxElementForVariableUnderCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2524
    "for a better search; ignored here, but redefined in CodeView2"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2525
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2526
    ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2527
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2528
    "Created: / 08-03-2012 / 12:45:26 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2529
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2530
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2531
!TextView methodsFor:'private'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2532
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2533
currentSelectionBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2534
    ^  selectionBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2535
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2536
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2537
currentSelectionFgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2538
    ^ selectionFgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2539
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2540
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2541
fileOutContentsOn:aStream
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2542
    "save contents on a stream, replacing leading spaces by tab-characters."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2543
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2544
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2545
	fileOutContentsOn:aStream
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2546
	compressTabs:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2547
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2548
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2549
fileOutContentsOn:aStream compressTabs:compressTabs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2550
    "save contents on a stream. If compressTabs is true,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2551
     leading spaces will be replaced by tab-characters in the output."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2552
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2553
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2554
	fileOutContentsOn:aStream
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2555
	compressTabs:compressTabs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2556
	encoding:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2557
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2558
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2559
fileOutContentsOn:aStream compressTabs:compressTabs encoding:encodingSymOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2560
    "save contents on a stream. If compressTabs is true,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2561
     leading spaces will be replaced by tab-characters in the output."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2562
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2563
    |startNr nLines string encoder|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2564
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2565
    self removeTrailingWhitespace.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2566
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2567
    encoder := CharacterEncoder encoderToEncodeFrom:gc characterEncoding into:encodingSymOrNil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2568
    encoder isNullEncoder ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2569
	(list contains:[:lineOrNil|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2570
			    |s|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2571
			    lineOrNil notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2572
			    and:[(s := lineOrNil string string) isWideString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2573
			    and:[s asSingleByteStringIfPossible isWideString]]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2574
		       ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2575
	) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2576
	    (Dialog confirm:'The text contains non-8bit characters. Encode as UTF8?') ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2577
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2578
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2579
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2580
	encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2581
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2582
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2583
    aStream isFileStream ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2584
	"on some systems, writing linewise is very slow (via NFS)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2585
	 therefore we convert to a string and write it in big chunks.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2586
	 To avoid creating huge strings, we do it in blocks of 1000 lines,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2587
	 limiting temporary string creation to about 50-80k.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2588
	"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2589
	startNr := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2590
	nLines := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2591
	[startNr <= nLines] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2592
	    string := list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2593
			asStringWithCRsFrom:startNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2594
			to:((startNr + 1000) min:nLines)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2595
			compressTabs:compressTabs.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2596
	    aStream nextPutAll:(encoder encodeString:string string).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2597
	    startNr := startNr + 1000 + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2598
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2599
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2600
	list do:[:aLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2601
	    aLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2602
		aStream nextPutLine:(encoder encodeString:aLine).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2603
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2604
		aStream cr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2605
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2606
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2607
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2608
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2609
    "Modified: 8.6.1996 / 11:50:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2610
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2611
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2612
getFontParameters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2613
    "get some info of the used font. They are cached since we use them often ..
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2614
     This is redefined here, to use the font's maxHeight/maxAscent for
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2615
     line separation. This is required, to allow for proper handling of
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2616
     national characters, such as A-diaresis ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2617
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2618
    |italicFont boldFont fA iA bA currentDeviceFont|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2619
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2620
    currentDeviceFont := gc createFontOnDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2621
    italicFont := currentDeviceFont asItalic onDevice:gc device.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2622
    boldFont := currentDeviceFont asBold onDevice:gc device.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2623
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2624
    fontHeight := currentDeviceFont height max:(italicFont height max:(boldFont height)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2625
    includesNonStrings == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2626
	"/ for now, we do not support variable height entries ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2627
	fontHeight := fontHeight max:(list first heightOn:self).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2628
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2629
    fontHeight := fontHeight + lineSpacing.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2630
    fA := currentDeviceFont ascent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2631
    "/ fA := font maxAscent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2632
    iA := italicFont ascent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2633
    "/ iA := italicFont maxAscent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2634
    bA := boldFont ascent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2635
    "/ bA := boldFont maxAscent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2636
    fontAscent := fA max:(iA max:bA).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2637
    fontWidth := currentDeviceFont width.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2638
    fontIsFixedWidth := currentDeviceFont isFixedWidth and:[ italicFont isFixedWidth and:[ boldFont isFixedWidth ]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2639
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2640
    "Modified: 22.5.1996 / 12:02:47 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2641
    "Created: 22.5.1996 / 12:18:34 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2642
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2643
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2644
isClosingParenthesis:ch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2645
    ((parenthesisSpecification at:#close) includes:ch) ifTrue:[^ true].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2646
    ^ ')]}' includes:ch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2647
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2648
    "Modified: / 12-02-2012 / 08:37:01 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2649
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2650
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2651
isOpeningParenthesis:ch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2652
    ((parenthesisSpecification at:#open) includes:ch) ifTrue:[^ true].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2653
    ^ '([{' includes:ch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2654
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2655
    "Modified: / 12-02-2012 / 08:37:11 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2656
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2657
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2658
rememberSearchPattern:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2659
    |nRemembered patternString|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2660
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2661
    self clearSearchAction.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2662
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2663
    patternString := pattern string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2664
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2665
    nRemembered := NumRememberedSearchPatterns ? 20.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2666
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2667
    LastSearchPatterns isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2668
	LastSearchPatterns := OrderedCollection new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2669
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2670
    "/ move to top or addFirst
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2671
    (LastSearchPatterns includes:patternString) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2672
	LastSearchPatterns remove:patternString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2673
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2674
	LastSearchPatterns size > nRemembered ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2675
	    LastSearchPatterns removeLast
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2676
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2677
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2678
    LastSearchPatterns addFirst:patternString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2679
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2680
    "Modified: / 23-03-2012 / 13:59:09 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2681
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2682
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2683
removeTrailingWhitespace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2684
    list isNil ifTrue:[^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2685
    list keysAndValuesDo:[:lineNR :line |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2686
	|l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2687
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2688
	line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2689
	    l := line withoutTrailingSeparators.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2690
	    list at:lineNR put:l.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2691
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2692
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2693
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2694
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2695
resetVariablesBeforeNewSearch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2696
    "clear the autosearch action, when the first pattern is searched for"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2697
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2698
    searchAction := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2699
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2700
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2701
scrollSelectDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2702
    "auto scroll action; scroll and reinstall timed-block"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2703
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2704
    |prevEndLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2705
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2706
    "just to make certain ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2707
    selectionEndLine isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2708
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2709
    self scrollDown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2710
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2711
    "make new selection immediately visible"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2712
    prevEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2713
    selectionEndLine := firstLineShown + nFullLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2714
    selectionEndCol := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2715
    prevEndLine to:selectionEndLine do:[:lineNr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2716
	self redrawLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2717
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2718
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2719
    self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2720
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2721
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2722
scrollSelectLeft
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2723
    "auto scroll action; scroll and reinstall timed-block"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2724
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2725
    |prevStartLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2726
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2727
    "just to make certain ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2728
    selectionStartLine isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2729
    selectionStartCol isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2730
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2731
    "make new selection immediately visible"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2732
    prevStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2733
    selectionStartCol := selectionStartCol - 1 max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2734
    self scrollLeft.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2735
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2736
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2737
    self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2738
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2739
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2740
scrollSelectRight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2741
    "auto scroll action; scroll and reinstall timed-block"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2742
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2743
    |prevEndCol firstVisibleCol endLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2744
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2745
    "just to make certain ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2746
    selectionEndCol isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2747
    selectionEndLine isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2748
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2749
    prevEndCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2750
    selectionEndCol := (selectionEndCol + 1) min:(self listAt:selectionEndLine) size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2751
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2752
    endLine := self listLineToVisibleLine:selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2753
    endLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2754
	firstVisibleCol := self colOfX:1 inVisibleLine:endLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2755
	selectionEndCol < firstVisibleCol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2756
	    "/ scrolling faster than selection advances...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2757
	    selectionEndCol := firstVisibleCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2758
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2759
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2760
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2761
    self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2762
    self scrollRight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2763
    "/ self repairDamage.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2764
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2765
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2766
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2767
    "Modified: / 05-08-2010 / 21:25:56 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2768
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2769
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2770
scrollSelectUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2771
    "auto scroll action; scroll and reinstall timed-block"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2772
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2773
    |prevStartLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2774
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2775
    "just to make certain ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2776
    selectionStartLine isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2777
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2778
    self scrollUp.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2779
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2780
    "make new selection immediately visible"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2781
    prevStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2782
    selectionStartLine := firstLineShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2783
    selectionStartCol := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2784
    selectionStartLine to:prevStartLine do:[:lineNr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2785
	self redrawLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2786
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2787
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2788
    self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2789
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2790
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2791
stopScrollSelect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2792
    "stop auto scroll; deinstall timed-block"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2793
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2794
    autoScrollBlock notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2795
	Processor removeTimedBlock:autoScrollBlock.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2796
	self compressMotionEvents:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2797
	autoScrollBlock := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2798
	autoScrollDeltaT := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2799
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2800
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2801
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2802
widthForScrollBetween:firstLine and:lastLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2803
    "return the width in pixels for a scroll between firstLine and lastLine"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2804
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2805
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2806
	"/ if there is a selection which covers multiple lines,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2807
	"/ we have to scroll the whole width (to include the selection-rectangle)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2808
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2809
	(lastLine < selectionStartLine) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2810
	    (firstLine > selectionEndLine) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2811
		^ width
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2812
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2813
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2814
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2815
    ^ super widthForScrollBetween:firstLine and:lastLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2816
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2817
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2818
!TextView methodsFor:'queries'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2819
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2820
hasSearchActionSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2821
    "Here we fake the use of typeOfSelection which is really in EditTextView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2822
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2823
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2824
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2825
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2826
specClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2827
    "redefined, since the name of my specClass is nonStandard (i.e. not TextViewSpec)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2828
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2829
    self class == TextView ifTrue:[^ TextEditorSpec].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2830
    ^ super specClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2831
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2832
    "Modified: / 31.10.1997 / 19:48:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2833
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2834
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2835
!TextView methodsFor:'redrawing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2836
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2837
clearMarginOfVisibleLine:visLine with:color
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2838
    "if there is a margin, clear it - a helper for selection drawing"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2839
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2840
    (leftMargin ~~ 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2841
	viewOrigin x <= margin ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2842
	    self paint:color.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2843
	    self fillRectangleX:margin-viewOrigin x
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2844
			      y:(self yOfVisibleLine:visLine)- (lineSpacing//2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2845
			  width:leftMargin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2846
			 height:fontHeight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2847
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2848
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2849
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2850
    "Created: 6.3.1996 / 14:22:55 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2851
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2852
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2853
drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2854
    startVisLineNr to:endVisLineNr do:[:visLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2855
	self drawVisibleLineSelected:visLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2856
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2857
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2858
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2859
drawVisibleLineSelected:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2860
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2861
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2862
	inVisible:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2863
	with:self currentSelectionFgColor and:self currentSelectionBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2864
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2865
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2866
drawVisibleLineSelected:visLineNr col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2867
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2868
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2869
	inVisible:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2870
	col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2871
	with:self currentSelectionFgColor and:self currentSelectionBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2872
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2873
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2874
drawVisibleLineSelected:visLineNr from:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2875
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2876
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2877
	inVisible:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2878
	from:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2879
	with:self currentSelectionFgColor and:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2880
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2881
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2882
drawVisibleLineSelected:visLineNr from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2883
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2884
	drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2885
	inVisible:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2886
	from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2887
	with:self currentSelectionFgColor and:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2888
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2889
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2890
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2891
    "redraw a visible line range"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2892
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2893
    |startLine endLine specialCare end selVisStart line1 line2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2894
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2895
    shown ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2896
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2897
    end := endVisLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2898
    (end > nLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2899
	end := nLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2900
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2901
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2902
    selectionEndLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2903
	selectionStartLine := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2904
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2905
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2906
    selectionStartLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2907
	specialCare := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2908
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2909
	startLine := self visibleLineToAbsoluteLine:startVisLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2910
	(startLine > selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2911
	    specialCare := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2912
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2913
	    endLine := self visibleLineToAbsoluteLine:end.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2914
	    (endLine < selectionStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2915
		specialCare := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2916
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2917
		specialCare := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2918
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2919
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2920
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2921
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2922
    "easy: nothing is selected"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2923
    specialCare ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2924
	super redrawFromVisibleLine:startVisLineNr to:end.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2925
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2926
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2927
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2928
    "easy: all is selected"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2929
    ((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2930
	self drawSelectedFromVisibleLine:startVisLineNr to:end.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2931
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2932
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2933
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2934
    (selectionStartLine >= firstLineShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2935
	"draw unselected top part"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2936
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2937
	selVisStart := self listLineToVisibleLine:selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2938
	super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2939
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2940
	"and first partial selected line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2941
	self redrawVisibleLine:selVisStart.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2942
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2943
	"rest starts after this one"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2944
	line1 := selVisStart + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2945
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2946
	line1 := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2947
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2948
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2949
    (line1 > end) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2950
    (line1 < startVisLineNr) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2951
	line1 := startVisLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2952
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2953
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2954
    "draw middle part of selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2955
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2956
    (selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2957
	line2 := nLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2958
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2959
	line2 := (self listLineToVisibleLine:selectionEndLine) - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2960
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2961
    (line2 > end) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2962
	line2 := end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2963
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2964
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2965
    self drawSelectedFromVisibleLine:line1 to:line2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2966
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2967
    (line2 >= end) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2968
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2969
    "last line of selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2970
    self redrawVisibleLine:(line2 + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2971
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2972
    ((line2 + 2) <= end) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2973
	super redrawFromVisibleLine:(line2 + 2) to:end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2974
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2975
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2976
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2977
redrawVisibleLine:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2978
    "redraw visible line lineNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2979
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2980
    |line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2981
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2982
    (selectionStartLine notNil and:[selectionEndLine notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2983
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2984
	line := self visibleLineToAbsoluteLine:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2985
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2986
	    (line == selectionStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2987
		(line == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2988
		    "it's part-of-single-line selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2989
		    self clearMarginOfVisibleLine:visLineNr with:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2990
		    (selectionStartCol > 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2991
			super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2992
		    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2993
		    self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2994
		    super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2995
		    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2996
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2997
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2998
		"it's the first line of a multi-line selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2999
		(selectionStartCol ~~ 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3000
		    self clearMarginOfVisibleLine:visLineNr with:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3001
		    super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3002
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3003
		    viewOrigin x == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3004
			self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3005
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3006
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3007
		self drawVisibleLineSelected:visLineNr from:selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3008
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3009
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3010
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3011
	    (line == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3012
		"it's the last line of a multi-line selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3013
		(selectionEndCol == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3014
		    ^ super redrawVisibleLine:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3015
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3016
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3017
		self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3018
		self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3019
		super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3020
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3021
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3022
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3023
	    "it's a full line in a multi-line selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3024
	    self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3025
	    self drawVisibleLineSelected:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3026
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3027
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3028
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3029
    super redrawVisibleLine:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3030
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3031
    "Modified: 6.3.1996 / 14:22:19 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3032
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3033
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3034
redrawVisibleLine:visLine col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3035
    "redraw single character at col in visible line lineNr."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3036
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3037
    |line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3038
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3039
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3040
    "/ care for selection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3041
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3042
    (selectionStartLine notNil and:[selectionEndLine notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3043
    and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3044
	line := self visibleLineToAbsoluteLine:visLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3045
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3046
	    ((line == selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3047
	    and: [col < selectionStartCol]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3048
		((line == selectionEndLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3049
		and: [col > selectionEndCol]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3050
		    "its in the selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3051
		    self drawVisibleLineSelected:visLine col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3052
		    ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3053
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3054
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3055
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3056
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3057
    self drawVisibleLine:visLine col:col with:fgColor and:bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3058
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3059
    "Modified: / 22.4.1998 / 08:53:05 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3060
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3061
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3062
redrawVisibleLine:visLine from:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3063
    "redraw visible line lineNr from startCol to end of line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3064
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3065
    |col line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3066
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3067
    col := startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3068
    col == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3069
	col := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3070
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3071
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3072
    (selectionStartLine notNil and:[selectionEndLine notNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3073
	line := self visibleLineToAbsoluteLine:visLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3074
	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3075
	    ((line == selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3076
	     or:[line == selectionEndLine]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3077
		"since I'm lazy, redraw full line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3078
		self redrawVisibleLine:visLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3079
		^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3080
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3081
	    "the line is fully within the selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3082
	    self drawVisibleLineSelected:visLine from:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3083
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3084
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3085
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3086
    super redrawVisibleLine:visLine from:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3087
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3088
    "Modified: 6.3.1996 / 14:19:38 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3089
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3090
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3091
redrawVisibleLine:visLine from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3092
    "redraw visible line lineNr from startCol to endCol"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3093
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3094
    |line allOut allIn leftCol rightCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3095
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3096
    line := self visibleLineToAbsoluteLine:visLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3097
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3098
    allIn := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3099
    allOut := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3100
    (selectionStartLine isNil or:[selectionEndLine isNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3101
    or:[selectionStartCol isNil or:[selectionEndCol isNil]]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3102
	allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3103
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3104
	(line between:selectionStartLine and:selectionEndLine) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3105
	    allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3106
	] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3107
	    (selectionStartLine == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3108
		((endCol < selectionStartCol)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3109
		or:[startCol > selectionEndCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3110
		    allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3111
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3112
		    ((startCol >= selectionStartCol)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3113
		    and:[endCol <= selectionEndCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3114
			allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3115
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3116
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3117
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3118
		(line == selectionStartLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3119
		    (endCol < selectionStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3120
			allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3121
		    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3122
			(startCol >= selectionStartCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3123
			    allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3124
			]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3125
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3126
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3127
		    (line == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3128
			(startCol > selectionEndCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3129
			    allOut := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3130
			] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3131
			    (endCol <= selectionEndCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3132
				allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3133
			    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3134
			]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3135
		    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3136
			allIn := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3137
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3138
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3139
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3140
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3141
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3142
    allOut ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3143
	super redrawVisibleLine:visLine from:startCol to:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3144
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3145
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3146
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3147
    allIn ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3148
	self drawVisibleLineSelected:visLine from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3149
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3150
	"redraw part before selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3151
	((line == selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3152
	 and:[startCol <= selectionStartCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3153
	    super redrawVisibleLine:visLine from:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3154
					      to:(selectionStartCol - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3155
	    leftCol := selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3156
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3157
	    leftCol := startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3158
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3159
	"redraw selected part"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3160
	(selectionEndLine > line) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3161
	    rightCol := endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3162
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3163
	    rightCol := selectionEndCol min:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3164
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3165
	self drawVisibleLineSelected:visLine from:leftCol to:rightCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3166
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3167
	"redraw part after selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3168
	(rightCol < endCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3169
	    super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3170
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3171
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3172
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3173
    "special care for first and last line of selection:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3174
     must handle margin also"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3175
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3176
    ((line == selectionEndLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3177
    and:[(startCol == 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3178
    and:[selectionStartLine < selectionEndLine]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3179
    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3180
	self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3181
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3182
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3183
    ((line == selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3184
    and:[(startCol == 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3185
    and:[selectionStartLine < selectionEndLine]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3186
    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3187
	self clearMarginOfVisibleLine:visLine with:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3188
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3189
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3190
    ((line > selectionStartLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3191
    and:[(startCol == 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3192
    and:[selectionStartLine < selectionEndLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3193
    and:[line < selectionEndLine]]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3194
    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3195
	self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3196
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3197
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3198
    "Modified: 6.3.1996 / 14:23:26 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3199
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3200
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3201
!TextView methodsFor:'searching'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3202
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3203
clearSearchAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3204
    searchAction := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3205
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3206
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3207
scanFor:aCharacter fromLine:startLine col:startCol forward:forward
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3208
		     ifFound:foundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3209
		  ifNotFound:notFoundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3210
    "search for a character in the direction given by forward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3211
     Performs foundBlock with line/col as argument if found, notFoundBlock if not."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3212
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3213
    |lineString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3214
     line   "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3215
     col    "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3216
     delta  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3217
     endCol "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3218
     cc
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3219
     maxLine "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3220
      |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3221
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3222
    col := startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3223
    line := startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3224
    forward ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3225
	delta := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3226
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3227
	delta := -1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3228
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3229
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3230
    lineString := list at:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3231
    maxLine := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3232
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3233
    col := col + delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3234
    [true] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3235
	lineString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3236
	    forward ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3237
		endCol := lineString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3238
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3239
		endCol := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3240
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3241
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3242
	    col to:endCol by:delta do:[:rCol |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3243
		cc := lineString at:rCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3244
		cc == aCharacter ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3245
		    ^ foundBlock value:line value:rCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3246
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3247
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3248
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3249
	line := line + delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3250
	(line < 1 or:[line > maxLine]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3251
	    ^ notFoundBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3252
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3253
	lineString := list at:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3254
	forward ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3255
	    col := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3256
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3257
	    col := lineString size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3258
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3259
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3260
    "not reached"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3261
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3262
    "Modified: 15.10.1996 / 12:22:30 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3263
    "Created: 11.9.1997 / 04:36:29 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3264
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3265
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3266
searchAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3267
    ^ searchAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3268
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3269
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3270
searchAction:aSearcherOrSearchBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3271
    searchAction := aSearcherOrSearchBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3272
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3273
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3274
searchAgainInSameDirection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3275
    "search again in the same direction and -if found- position cursor"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3276
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3277
    |ign match|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3278
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3279
    searchBarActionBlock notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3280
	searchBarActionBlock value:#forward value:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3281
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3282
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3283
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3284
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3285
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3286
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3287
    self setSearchPatternWithMatchEscapes: match.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3288
    lastSearchPattern notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3289
	lastSearchDirection == #backward ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3290
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3291
		searchBwd:lastSearchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3292
		ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3293
		match: match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3294
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3295
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3296
		searchFwd:lastSearchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3297
		ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3298
		match: match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3299
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3300
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3301
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3302
    "Created: / 03-05-1999 / 15:02:16 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3303
    "Modified: / 21-09-2006 / 16:47:57 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3304
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3305
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3306
searchBwd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3307
    "search backward (for the same thing again)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3308
     If found, position cursor"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3309
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3310
    |ign selectedVariable|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3311
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3312
    searchAction notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3313
	"/autosearch is cleared whenever there is search with user selection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3314
	(self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3315
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3316
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3317
    searchAction notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3318
	"/confusing: this is for autosearch of variables (browse variable uses, for example)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3319
	self searchUsingSearchAction:#backward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3320
	^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3321
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3322
    searchBarActionBlock notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3323
	searchBarActionBlock value:#backward value:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3324
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3325
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3326
    lastSearchWasVariableSearch ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3327
	selectedVariable := self syntaxElementForSelectedVariable.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3328
	selectedVariable notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3329
	    self searchVariableWithSyntaxElement:selectedVariable forward:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3330
	    ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3331
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3332
	lastSearchWasVariableSearch := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3333
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3334
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3335
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3336
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3337
    self setSearchPatternWithMatchEscapes: false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3338
    lastSearchPattern isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3339
	LastSearchPatterns size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3340
	    lastSearchPattern := LastSearchPatterns first
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3341
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3342
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3343
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3344
    lastSearchPattern notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3345
	lastSearchDirection := #backward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3346
	self rememberSearchPattern:lastSearchPattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3347
	self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3348
	    searchBwd:lastSearchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3349
	    ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3350
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3351
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3352
    "Modified: / 08-03-2012 / 14:26:25 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3353
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3354
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3355
searchBwd:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3356
    "do a backward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3357
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3358
    self searchBwd:pattern ifAbsent:[self showNotFound].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3359
"/    lastSearchIgnoredCase := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3360
    lastSearchPattern := pattern string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3361
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3362
    "Modified: / 21-09-2006 / 16:48:29 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3363
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3364
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3365
searchBwd:pattern ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3366
    "do a backward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3367
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3368
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3369
	searchBwdUsingSpec:(ListView::SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3370
					pattern:pattern)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3371
	ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3372
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3373
    "Modified: 13.9.1997 / 01:05:49 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3374
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3375
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3376
searchBwd:pattern ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3377
    "do a backward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3378
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3379
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3380
	searchBwd:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3381
	ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3382
	ifAbsent:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3383
		    self sensor compressKeyPressEventsWithKey:#FindPrev.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3384
		    self showNotFound
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3385
		 ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3386
    "/ lastSearchIgnoredCase := ign.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3387
    lastSearchPattern := pattern string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3388
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3389
    "Created: / 13-09-1997 / 06:18:00 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3390
    "Modified: / 23-03-2012 / 12:10:25 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3391
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3392
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3393
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3394
    "do a backward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3395
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3396
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3397
	searchBwdUsingSpec:(ListView::SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3398
					pattern:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3399
					ignoreCase:ign)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3400
	ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3401
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3402
    "Modified: 13.9.1997 / 01:05:49 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3403
    "Created: 13.9.1997 / 06:18:41 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3404
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3405
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3406
searchBwd:pattern ignoreCase:ign match: match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3407
    "do a backward search.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3408
    match pattern functionality is not yet available for backward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3409
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3410
    "/ lastSearchWasMatch := match.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3411
    self searchBwd:pattern ignoreCase:ign.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3412
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3413
    "Modified: / 23-03-2012 / 12:12:44 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3414
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3415
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3416
searchBwdUsingSpec:searchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3417
    "do a backward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3418
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3419
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3420
	searchBwdUsingSpec:searchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3421
	ifAbsent:[self showNotFound].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3422
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3423
"/    lastSearchIgnoredCase := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3424
    lastSearchPattern := searchSpec pattern string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3425
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3426
    "Modified: / 21-09-2006 / 16:48:29 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3427
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3428
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3429
searchBwdUsingSpec:searchSpec ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3430
    "do a backward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3431
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3432
    |pos startLine startCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3433
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3434
    pos :=  self startPositionForSearchBackward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3435
    startLine := pos y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3436
    startCol := pos x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3437
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3438
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3439
	searchBackwardUsingSpec:searchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3440
	startingAtLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3441
	ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3442
	ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3443
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3444
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3445
searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3446
    "select characters enclosed by matching parenthesis if one is under startLine/Col"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3447
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3448
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3449
	searchForMatchingParenthesisFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3450
	ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3451
		  self selectFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3452
			       toLine:line col:col]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3453
	ifNotFound:[self showNotFound]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3454
	onError:[self beep]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3455
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3456
    "Modified: 9.10.1997 / 12:57:34 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3457
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3458
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3459
searchForMatchingParenthesisFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3460
		     ifFound:foundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3461
		  ifNotFound:notFoundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3462
		     onError:failBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3463
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3464
    "search for a matching parenthesis; start search with character at startLine/startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3465
     Search for the corresponding character is done forward if its an opening,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3466
     backwards if its a closing parenthesis.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3467
     Evaluate foundBlock with line/col as argument if found, notFoundBlock if not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3468
     If there is a nesting error, evaluate failBlock."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3469
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3470
    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3471
	searchForMatchingParenthesisFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3472
	ifFound:foundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3473
	ifNotFound:notFoundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3474
	onError:failBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3475
	ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3476
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3477
    "Modified: / 12-04-2007 / 11:24:24 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3478
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3479
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3480
searchForMatchingParenthesisFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3481
		     ifFound:foundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3482
		  ifNotFound:notFoundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3483
		     onError:failBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3484
		    ignoring:ignoreSet
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3485
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3486
    "search for a matching parenthesis; start search with character at startLine/startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3487
     Search for the corresponding character is done forward if its an opening,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3488
     backwards if its a closing parenthesis.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3489
     Evaluate foundBlock with line/col as argument if found, notFoundBlock if not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3490
     If there is a nesting error, evaluate failBlock."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3491
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3492
    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3493
	searchForMatchingParenthesisFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3494
	ifFound:foundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3495
	ifNotFound:notFoundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3496
	onError:failBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3497
	openingCharacters: (parenthesisSpecification at:#open)  "/ #( $( $[ ${ "$> $<")
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3498
	closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<")
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3499
	ignoredCharacters: ignoreSet
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3500
	specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3501
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3502
"/    |i direction lineString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3503
"/     parChar charSet  closingChar
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3504
"/     ignoring
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3505
"/     line   "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3506
"/     col    "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3507
"/     delta  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3508
"/     endCol "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3509
"/     runCol "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3510
"/     cc prevCC nextCC incSet decSet
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3511
"/     nesting "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3512
"/     maxLine "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3513
"/     ign skip anySet|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3514
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3515
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3516
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3517
"/    parChar := self characterAtLine:startLine col:startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3518
"/    i := charSet indexOf:parChar.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3519
"/    i == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3520
"/        ^ failBlock value   "not a parenthesis"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3521
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3522
"/    direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3523
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3524
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3525
"/    col := startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3526
"/    line := startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3527
"/    direction == #fwd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3528
"/        delta := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3529
"/        incSet := #( $( $[ ${ "$<" ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3530
"/        decSet := #( $) $] $} "$>" ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3531
"/    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3532
"/        delta := -1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3533
"/        incSet := #( $) $] $} "$>" ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3534
"/        decSet := #( $( $[ ${ "$<" ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3535
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3536
"/    anySet := Set new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3537
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3538
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3539
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3540
"/    nesting := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3541
"/    ignoring := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3542
"/    lineString := list at:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3543
"/    maxLine := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3544
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3545
"/    col := col + delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3546
"/    [nesting ~~ 0] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3547
"/        (lineString notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3548
"/        and:[lineString includesAny:anySet]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3549
"/            direction == #fwd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3550
"/                endCol := lineString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3551
"/            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3552
"/                endCol := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3553
"/            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3554
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3555
"/            col to:endCol by:delta do:[:rCol |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3556
"/                runCol := rCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3557
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3558
"/                cc := lineString at:runCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3559
"/                runCol < lineString size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3560
"/                    nextCC := lineString at:runCol+1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3561
"/                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3562
"/                    nextCC := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3563
"/                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3564
"/                runCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3565
"/                    prevCC := lineString at:runCol-1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3566
"/                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3567
"/                    prevCC := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3568
"/                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3569
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3570
"/                ign := skip := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3571
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3572
"/                "/ check for comments.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3573
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3574
"/                ((cc == $" and:[nextCC == $/])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3575
"/                or:[prevCC == $$ ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3576
"/                    "/ do nothing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3577
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3578
"/                    skip := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3579
"/                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3580
"/                    ignoreSet do:[:ignore |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3581
"/                        ignore == cc ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3582
"/                            ign := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3583
"/                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3584
"/                            ignore isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3585
"/                                cc == (ignore at:2) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3586
"/                                    runCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3587
"/                                        (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3588
"/                                            skip := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3589
"/                                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3590
"/                                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3591
"/                                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3592
"/                                    cc == (ignore at:1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3593
"/                                        runCol < lineString size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3594
"/                                            (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3595
"/                                                skip := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3596
"/                                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3597
"/                                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3598
"/                                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3599
"/                                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3600
"/                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3601
"/                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3602
"/                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3603
"/                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3604
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3605
"/                ign ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3606
"/                    ignoring := ignoring not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3607
"/                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3608
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3609
"/                ignoring ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3610
"/                    skip ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3611
"/                        (incSet includes:cc) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3612
"/                            nesting := nesting + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3613
"/                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3614
"/                            (decSet includes:cc) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3615
"/                                nesting := nesting - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3616
"/                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3617
"/                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3618
"/                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3619
"/                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3620
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3621
"/                nesting == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3622
"/                    "check if legal"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3623
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3624
"/                    skip ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3625
"/                        cc == closingChar ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3626
"/                            ^ failBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3627
"/                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3628
"/                        ^ foundBlock value:line value:runCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3629
"/                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3630
"/                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3631
"/            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3632
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3633
"/        line := line + delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3634
"/        (line < 1 or:[line > maxLine]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3635
"/            ^ failBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3636
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3637
"/        lineString := list at:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3638
"/        direction == #fwd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3639
"/            col := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3640
"/        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3641
"/            col := lineString size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3642
"/        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3643
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3644
"/    ^ notFoundBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3645
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3646
    "Modified: / 12-04-2007 / 11:25:36 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3647
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3648
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3649
searchForMatchingParenthesisFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3650
		     ifFound:foundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3651
		  ifNotFound:notFoundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3652
		     onError:failBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3653
	   openingCharacters:openingCharacters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3654
	   closingCharacters:closingCharacters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3655
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3656
    "search for a matching parenthesis; start search with character at startLine/startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3657
     Search for the corresponding character is done forward if its an opening,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3658
     backwards if its a closing parenthesis.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3659
     Evaluate foundBlock with line/col as argument if found, notFoundBlock if not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3660
     If there is a nesting error, evaluate failBlock."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3661
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3662
    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3663
	searchForMatchingParenthesisFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3664
	ifFound:foundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3665
	ifNotFound:notFoundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3666
	onError:failBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3667
	openingCharacters: openingCharacters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3668
	closingCharacters: closingCharacters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3669
	ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#())
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3670
	specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3671
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3672
"/    |i direction lineString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3673
"/     parChar charSet  closingChar
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3674
"/     ignoring
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3675
"/     line   "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3676
"/     col    "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3677
"/     delta  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3678
"/     endCol "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3679
"/     runCol "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3680
"/     cc prevCC nextCC incSet decSet
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3681
"/     nesting "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3682
"/     maxLine "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3683
"/     ign skip anySet|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3684
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3685
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3686
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3687
"/    parChar := self characterAtLine:startLine col:startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3688
"/    i := charSet indexOf:parChar.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3689
"/    i == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3690
"/        ^ failBlock value   "not a parenthesis"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3691
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3692
"/    direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3693
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3694
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3695
"/    col := startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3696
"/    line := startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3697
"/    direction == #fwd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3698
"/        delta := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3699
"/        incSet := #( $( $[ ${ "$<" ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3700
"/        decSet := #( $) $] $} "$>" ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3701
"/    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3702
"/        delta := -1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3703
"/        incSet := #( $) $] $} "$>" ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3704
"/        decSet := #( $( $[ ${ "$<" ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3705
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3706
"/    anySet := Set new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3707
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3708
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3709
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3710
"/    nesting := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3711
"/    ignoring := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3712
"/    lineString := list at:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3713
"/    maxLine := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3714
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3715
"/    col := col + delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3716
"/    [nesting ~~ 0] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3717
"/        (lineString notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3718
"/        and:[lineString includesAny:anySet]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3719
"/            direction == #fwd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3720
"/                endCol := lineString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3721
"/            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3722
"/                endCol := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3723
"/            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3724
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3725
"/            col to:endCol by:delta do:[:rCol |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3726
"/                runCol := rCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3727
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3728
"/                cc := lineString at:runCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3729
"/                runCol < lineString size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3730
"/                    nextCC := lineString at:runCol+1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3731
"/                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3732
"/                    nextCC := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3733
"/                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3734
"/                runCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3735
"/                    prevCC := lineString at:runCol-1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3736
"/                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3737
"/                    prevCC := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3738
"/                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3739
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3740
"/                ign := skip := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3741
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3742
"/                "/ check for comments.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3743
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3744
"/                ((cc == $" and:[nextCC == $/])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3745
"/                or:[prevCC == $$ ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3746
"/                    "/ do nothing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3747
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3748
"/                    skip := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3749
"/                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3750
"/                    ignoreSet do:[:ignore |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3751
"/                        ignore == cc ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3752
"/                            ign := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3753
"/                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3754
"/                            ignore isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3755
"/                                cc == (ignore at:2) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3756
"/                                    runCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3757
"/                                        (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3758
"/                                            skip := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3759
"/                                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3760
"/                                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3761
"/                                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3762
"/                                    cc == (ignore at:1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3763
"/                                        runCol < lineString size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3764
"/                                            (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3765
"/                                                skip := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3766
"/                                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3767
"/                                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3768
"/                                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3769
"/                                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3770
"/                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3771
"/                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3772
"/                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3773
"/                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3774
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3775
"/                ign ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3776
"/                    ignoring := ignoring not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3777
"/                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3778
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3779
"/                ignoring ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3780
"/                    skip ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3781
"/                        (incSet includes:cc) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3782
"/                            nesting := nesting + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3783
"/                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3784
"/                            (decSet includes:cc) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3785
"/                                nesting := nesting - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3786
"/                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3787
"/                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3788
"/                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3789
"/                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3790
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3791
"/                nesting == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3792
"/                    "check if legal"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3793
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3794
"/                    skip ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3795
"/                        cc == closingChar ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3796
"/                            ^ failBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3797
"/                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3798
"/                        ^ foundBlock value:line value:runCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3799
"/                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3800
"/                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3801
"/            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3802
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3803
"/        line := line + delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3804
"/        (line < 1 or:[line > maxLine]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3805
"/            ^ failBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3806
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3807
"/        lineString := list at:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3808
"/        direction == #fwd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3809
"/            col := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3810
"/        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3811
"/            col := lineString size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3812
"/        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3813
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3814
"/    ^ notFoundBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3815
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3816
    "Modified: / 12-04-2007 / 11:25:36 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3817
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3818
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3819
searchForMatchingParenthesisFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3820
		     ifFound:foundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3821
		  ifNotFound:notFoundBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3822
		     onError:failBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3823
	   openingCharacters:openingCharacters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3824
	   closingCharacters:closingCharacters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3825
	   ignoredCharacters:ignoreSet
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3826
	  specialEOLComment:eolCommentSequence
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3827
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3828
    "search for a matching parenthesis; start search with character at startLine/startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3829
     Search for the corresponding character is done forward if its an opening,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3830
     backwards if its a closing parenthesis.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3831
     Evaluate foundBlock with line/col as argument if found, notFoundBlock if not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3832
     If there is a nesting error, evaluate failBlock."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3833
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3834
    |i direction lineString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3835
     parChar charSet  closingChar
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3836
     ignoring
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3837
     line   "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3838
     col    "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3839
     delta  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3840
     endCol "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3841
     runCol "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3842
     cc prevCC nextCC incSet decSet
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3843
     nesting "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3844
     maxLine "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3845
     ign skip anySet
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3846
     eol1 eol2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3847
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3848
    self assert:(openingCharacters size == closingCharacters size).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3849
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3850
    charSet := openingCharacters , closingCharacters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3851
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3852
    parChar := self characterAtLine:startLine col:startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3853
    i := charSet indexOf:parChar.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3854
    i == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3855
	^ failBlock value   "not a parenthesis"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3856
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3857
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3858
    direction := (i <= openingCharacters size) ifTrue:[#fwd] ifFalse:[#bwd].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3859
    closingChar := (closingCharacters , openingCharacters) at:i.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3860
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3861
    eol1 := eolCommentSequence at:1 ifAbsent:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3862
    eol2 := eolCommentSequence at:2 ifAbsent:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3863
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3864
    col := startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3865
    line := startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3866
    direction == #fwd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3867
	delta := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3868
	incSet := openingCharacters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3869
	decSet := closingCharacters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3870
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3871
	delta := -1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3872
	incSet := closingCharacters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3873
	decSet := openingCharacters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3874
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3875
    anySet := Set new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3876
    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3877
    anySet := (anySet select:[:c | c isCharacter]) asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3878
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3879
    nesting := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3880
    ignoring := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3881
    lineString := list at:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3882
    maxLine := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3883
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3884
    col := col + delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3885
    [nesting ~~ 0] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3886
	(lineString notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3887
	and:[lineString includesAny:anySet]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3888
	    direction == #fwd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3889
		endCol := lineString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3890
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3891
		endCol := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3892
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3893
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3894
	    col to:endCol by:delta do:[:rCol |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3895
		runCol := rCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3896
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3897
		cc := lineString at:runCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3898
		runCol < lineString size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3899
		    nextCC := lineString at:runCol+1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3900
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3901
		    nextCC := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3902
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3903
		runCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3904
		    prevCC := lineString at:runCol-1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3905
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3906
		    prevCC := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3907
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3908
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3909
		ign := skip := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3910
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3911
		"/ check for comments.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3912
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3913
		((cc == eol1 and:[nextCC == eol2])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3914
		or:[prevCC == $$ ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3915
		    "/ do nothing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3916
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3917
		    skip := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3918
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3919
		    ignoreSet do:[:ignore |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3920
			ignore == cc ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3921
			    ign := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3922
			] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3923
			    ignore isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3924
				cc == (ignore at:2) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3925
				    runCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3926
					(lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3927
					    skip := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3928
					]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3929
				    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3930
				] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3931
				    cc == (ignore at:1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3932
					runCol < lineString size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3933
					    (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3934
						skip := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3935
					    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3936
					]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3937
				    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3938
				]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3939
			    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3940
			]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3941
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3942
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3943
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3944
		ign ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3945
		    ignoring := ignoring not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3946
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3947
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3948
		ignoring ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3949
		    skip ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3950
			(incSet includes:cc) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3951
			    nesting := nesting + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3952
			] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3953
			    (decSet includes:cc) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3954
				nesting := nesting - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3955
			    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3956
			]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3957
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3958
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3959
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3960
		nesting == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3961
		    "check if legal"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3962
		    skip ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3963
			cc == closingChar ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3964
			    ^ failBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3965
			].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3966
			^ foundBlock value:line value:runCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3967
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3968
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3969
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3970
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3971
	line := line + delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3972
	(line < 1 or:[line > maxLine]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3973
	    ^ failBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3974
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3975
	lineString := list at:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3976
	direction == #fwd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3977
	    col := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3978
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3979
	    col := lineString size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3980
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3981
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3982
    ^ notFoundBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3983
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3984
    "Modified: 15.10.1996 / 12:22:30 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3985
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3986
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3987
searchFwd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3988
    "search forward for the same pattern or selection again"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3989
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3990
    |ign match variable|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3991
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3992
    searchAction notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3993
	"/ autosearch is cleared whenever there is search with user selection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3994
	(self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3995
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3996
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3997
    searchAction notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3998
	"/ confusing: this is for autosearch of variables (browse variable uses, for example)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3999
	self searchUsingSearchAction:#forward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4000
	^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4001
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4002
    searchBarActionBlock notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4003
	searchBarActionBlock value:#forward value:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4004
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4005
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4006
    lastSearchWasVariableSearch ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4007
	variable := self syntaxElementForSelectedVariable.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4008
	variable notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4009
	    self searchVariableWithSyntaxElement:variable forward:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4010
	    ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4011
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4012
	lastSearchWasVariableSearch := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4013
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4014
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4015
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4016
    match := lastSearchWasMatch ? LastSearchWasMatch ? false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4017
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4018
    selectStyle == #wordLeft ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4019
	"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4020
	 remove the space from the selection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4021
	"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4022
	selectionStartCol := selectionStartCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4023
	super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4024
	selectStyle := #word.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4025
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4026
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4027
    self setSearchPatternWithMatchEscapes: match.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4028
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4029
    lastSearchPattern isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4030
	LastSearchPatterns size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4031
	    lastSearchPattern := LastSearchPatterns first
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4032
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4033
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4034
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4035
    lastSearchPattern notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4036
	self rememberSearchPattern:lastSearchPattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4037
	lastSearchDirection := #forward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4038
	self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4039
	    searchFwd:lastSearchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4040
	    ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4041
	    match: match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4042
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4043
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4044
    "Modified: / 08-03-2012 / 14:25:42 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4045
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4046
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4047
searchFwd:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4048
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4049
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4050
    self searchFwd:pattern ifAbsent:[self showNotFound].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4051
"/    lastSearchIgnoredCase := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4052
    lastSearchPattern := pattern string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4053
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4054
    "Modified: / 21-09-2006 / 16:52:04 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4055
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4056
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4057
searchFwd:pattern ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4058
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4059
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4060
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4061
	searchFwdUsingSpec:(ListView::SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4062
				pattern:pattern)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4063
	ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4064
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4065
    "Modified: / 21-09-2006 / 16:51:28 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4066
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4067
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4068
searchFwd:pattern ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4069
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4070
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4071
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4072
	searchFwdUsingSpec:(ListView::SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4073
				pattern:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4074
				ignoreCase:ign)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4075
	ifAbsent:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4076
		    self sensor compressKeyPressEventsWithKey:#FindNext.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4077
		    self showNotFound
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4078
		 ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4079
    "/ lastSearchIgnoredCase := ign.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4080
    lastSearchPattern := pattern string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4081
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4082
    "Created: / 13-09-1997 / 06:18:13 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4083
    "Modified: / 23-03-2012 / 12:09:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4084
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4085
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4086
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4087
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4088
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4089
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4090
	searchFwdUsingSpec:(ListView::SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4091
				pattern:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4092
				ignoreCase:ign)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4093
	ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4094
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4095
    "Modified: 13.9.1997 / 01:05:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4096
    "Created: 13.9.1997 / 06:18:27 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4097
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4098
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4099
searchFwd:pattern ignoreCase:ign match: match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4100
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4101
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4102
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4103
	searchFwdUsingSpec:(ListView::SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4104
				pattern:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4105
				ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4106
				match:match)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4107
	ifAbsent:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4108
		    self sensor compressKeyPressEventsWithKey:#FindNext.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4109
		    self showNotFound
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4110
		 ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4111
    "/ lastSearchIgnoredCase := ign.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4112
    "/ lastSearchWasMatch := match.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4113
    lastSearchPattern := pattern string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4114
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4115
    "Created: / 13-09-1997 / 06:18:13 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4116
    "Modified: / 23-03-2012 / 12:12:47 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4117
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4118
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4119
searchFwd:pattern ignoreCase:ign match: match ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4120
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4121
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4122
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4123
	searchFwdUsingSpec:(ListView::SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4124
				pattern:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4125
				ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4126
				match:match)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4127
	ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4128
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4129
    "Modified: 13.9.1997 / 01:05:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4130
    "Created: 13.9.1997 / 06:18:27 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4131
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4132
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4133
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4134
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4135
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4136
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4137
	searchFwdUsingSpec:(ListView::SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4138
				pattern:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4139
				ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4140
				match:match)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4141
	startingAtLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4142
	ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4143
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4144
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4145
searchFwdUsingSpec:searchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4146
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4147
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4148
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4149
	searchFwdUsingSpec:searchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4150
	ifAbsent:[self showNotFound].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4151
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4152
"/    lastSearchIgnoredCase := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4153
    lastSearchPattern := searchSpec pattern string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4154
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4155
    "Modified: / 21-09-2006 / 16:52:04 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4156
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4157
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4158
searchFwdUsingSpec:searchSpec ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4159
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4160
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4161
    |pos startLine startCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4162
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4163
    pos := self startPositionForSearchForward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4164
    startLine := pos y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4165
    startCol := pos x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4166
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4167
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4168
	searchFwdUsingSpec:searchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4169
	startingAtLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4170
	ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4171
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4172
    "Modified: 13.9.1997 / 01:05:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4173
    "Created: 13.9.1997 / 06:18:27 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4174
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4175
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4176
searchFwdUsingSpec:searchSpec startingAtLine:startLine col:startCol ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4177
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4178
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4179
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4180
	searchForwardUsingSpec:searchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4181
	startingAtLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4182
	ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4183
	ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4184
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4185
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4186
searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4187
    "return the last search pattern"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4188
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4189
    ^ lastSearchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4190
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4191
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4192
searchUsingSearchAction:direction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4193
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4194
	searchUsingSearchAction:direction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4195
	ifAbsent:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4196
		    self sensor compressKeyPressEventsWithKey:#FindNext.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4197
		    self showNotFound
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4198
		 ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4199
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4200
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4201
searchUsingSearchAction:direction ifAbsent:notFoundAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4202
    |pos startLine startCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4203
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4204
    pos :=  direction == #backward
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4205
		ifTrue:[self startPositionForSearchBackward]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4206
		ifFalse:[self startPositionForSearchForward].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4207
    startLine := pos y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4208
    startCol := pos x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4209
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4210
    searchAction notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4211
	searchAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4212
	    value:direction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4213
	    value:startLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4214
	    value:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4215
	    value:[:line :col | self selectFromLine:line toLine:line]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4216
	    value:notFoundAction.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4217
	self hasSelection ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4218
	    self changeTypeOfSelectionTo: #searchAction.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4219
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4220
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4221
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4222
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4223
setSearchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4224
    "set the searchpattern from the selection if there is one"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4225
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4226
    self setSearchPatternWithMatchEscapes: false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4227
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4228
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4229
setSearchPattern:aStringOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4230
    "set the searchpattern for future searches"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4231
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4232
    aStringOrNil isEmptyOrNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4233
	lastSearchPattern := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4234
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4235
	lastSearchPattern := aStringOrNil asString withoutSeparators string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4236
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4237
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4238
    "Modified: / 6.3.1999 / 23:47:36 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4239
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4240
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4241
setSearchPattern:aString ignoreCase:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4242
    "set the searchpattern and caseIgnore for future searches"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4243
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4244
    self setSearchPattern:aString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4245
    lastSearchIgnoredCase := aBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4246
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4247
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4248
setSearchPatternWithMatchEscapes: match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4249
    "set the searchpattern from the selection if there is one"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4250
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4251
    |sel searchPattern |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4252
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4253
"/    clickPos isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4254
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4255
    sel := self selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4256
    sel notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4257
	searchPattern := sel asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4258
	match ifTrue:[searchPattern := searchPattern withMatchEscapes].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4259
	self setSearchPattern:searchPattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4260
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4261
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4262
    "Modified: / 6.3.1999 / 23:48:04 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4263
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4264
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4265
showMatch:pattern atLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4266
    "after a search, highlight the matched pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4267
     The code below needs a rewrite to take care of match-characters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4268
     (for now, it only highlights simple patterns and '*string*' correctly)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4269
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4270
    self showMatch:pattern isMatch:true atLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4271
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4272
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4273
showMatch:pattern isMatch:isMatch atLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4274
    "after a search, highlight the matched pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4275
     The code below needs a rewrite to take care of match-characters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4276
     (for now, it only highlights simple patterns and '*string*' correctly)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4277
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4278
    |realPattern|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4279
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4280
    realPattern := pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4281
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4282
    isMatch ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4283
	(realPattern startsWith:$*) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4284
	    realPattern := realPattern copyFrom:2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4285
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4286
	(realPattern endsWith:$*) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4287
	    realPattern := realPattern copyButLast:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4288
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4289
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4290
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4291
    self selectFromLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4292
		 toLine:line col:(col + realPattern size - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4293
    self makeLineVisible:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4294
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4295
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4296
showNotFound
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4297
    "search not found - tell user by beeping and changing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4298
     cursor for a while (sometimes I work with a headset :-)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4299
     (used to be: tell user by changing cursor for a while)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4300
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4301
    |savedCursor|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4302
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4303
    savedCursor := cursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4304
    [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4305
	self cursor:(Cursor cross).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4306
	self beep.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4307
	Processor activeProcess millisecondDelay:300.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4308
    ] ensure:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4309
	self cursor:savedCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4310
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4311
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4312
    "Modified: 20.2.1997 / 12:49:27 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4313
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4314
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4315
startPositionForSearchBackward
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4316
    ^ self startPositionForSearchBackwardBasedOnSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4317
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4318
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4319
startPositionForSearchBackwardBasedOnSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4320
    |startLine startCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4321
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4322
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4323
	startLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4324
	startCol := selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4325
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4326
	startLine := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4327
	startCol := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4328
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4329
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4330
    ^ startCol @ startLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4331
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4332
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4333
startPositionForSearchForward
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4334
    ^ self startPositionForSearchForwardBasedOnSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4335
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4336
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4337
startPositionForSearchForwardBasedOnSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4338
    |startLine startCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4339
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4340
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4341
	startLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4342
	startCol := selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4343
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4344
	startLine := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4345
	startCol := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4346
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4347
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4348
    ^ startCol @ startLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4349
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4350
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4351
!TextView methodsFor:'selections'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4352
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4353
changeTypeOfSelectionTo:newType
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4354
    "ignored here - but redefined in subclasses which
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4355
     differentiate between pasted- and user-selections"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4356
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4357
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4358
expandSelectionDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4359
    |l t|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4360
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4361
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4362
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4363
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4364
	    selectionStartLine := selectionStartLine + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4365
	    (selectionStartLine > clickLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4366
	    or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4367
	    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4368
		t := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4369
		selectionStartLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4370
		selectionEndLine := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4371
		t := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4372
		selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4373
		selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4374
		expandingTop := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4375
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4376
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4377
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4378
	    selectionEndLine := selectionEndLine + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4379
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4380
"/        self redrawLine:l.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4381
"/        self redrawLine:l+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4382
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4383
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4384
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4385
	self redrawFromLine:l to:l+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4386
	self makeSelectionVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4387
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4388
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4389
    "Created: / 01-03-1996 / 23:35:08 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4390
    "Modified: / 18-03-1996 / 17:18:15 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4391
    "Modified: / 17-04-2012 / 21:01:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4392
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4393
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4394
expandSelectionLeft
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4395
    |c l t c1 c2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4396
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4397
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4398
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4399
	    selectionStartCol == 0 ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4400
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4401
	    selectionStartCol := (selectionStartCol - 1) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4402
	    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4403
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4404
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4405
	    selectionEndCol := (selectionEndCol - 1) max:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4406
	    c := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4407
	    selectionEndLine == selectionStartLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4408
		selectionEndCol <= selectionStartCol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4409
		    t := selectionStartCol. selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4410
		    selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4411
		    expandingTop := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4412
		    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4413
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4414
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4415
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4416
	c1 := c.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4417
	c2 := c1 + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4418
	c1 == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4419
	    c1 := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4420
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4421
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4422
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4423
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4424
	self redrawLine:l from:c1 to:c2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4425
	self makeSelectionVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4426
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4427
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4428
    "Modified: / 18-03-1996 / 17:05:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4429
    "Modified: / 17-04-2012 / 21:01:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4430
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4431
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4432
expandSelectionRight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4433
    |l c t|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4434
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4435
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4436
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4437
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4438
	    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4439
	    selectionStartCol := selectionStartCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4440
	    l == selectionEndLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4441
		c >= selectionEndCol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4442
		    expandingTop := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4443
		    t := selectionStartCol. selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4444
		    selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4445
		    c := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4446
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4447
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4448
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4449
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4450
	    c := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4451
	    selectionEndCol := selectionEndCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4452
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4453
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4454
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4455
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4456
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4457
	self redrawLine:l from:(c max:1) to:c+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4458
	self makeSelectionVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4459
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4460
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4461
    "Created: / 01-03-1996 / 23:33:17 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4462
    "Modified: / 06-03-1996 / 13:54:10 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4463
    "Modified: / 17-04-2012 / 21:01:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4464
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4465
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4466
expandSelectionUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4467
    |l t|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4468
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4469
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4470
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4471
	    selectionStartLine := (selectionStartLine - 1) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4472
	    l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4473
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4474
	    selectionEndLine := (selectionEndLine - 1) max:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4475
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4476
	    l := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4477
	    (selectionEndLine < clickLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4478
	    or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4479
	    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4480
		t := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4481
		selectionStartLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4482
		selectionEndLine := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4483
		t := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4484
		selectionStartCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4485
		selectionEndCol := t.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4486
		l := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4487
		expandingTop := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4488
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4489
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4490
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4491
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4492
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4493
	"/ self redrawLine:l.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4494
	"/ self redrawLine:l+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4495
	self redrawFromLine:l to:l+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4496
	self makeSelectionVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4497
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4498
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4499
    "Modified: / 06-03-1996 / 14:12:06 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4500
    "Modified: / 17-04-2012 / 21:01:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4501
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4502
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4503
hasSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4504
    "return true, if there is a selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4505
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4506
    ^ selectionStartLine notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4507
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4508
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4509
hasSelectionForCopy
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4510
    "return true, if there is a selection which can be copyied
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4511
     (the same as #hasSelection, except for editfields in password-mode)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4512
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4513
    ^ self hasSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4514
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4515
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4516
hasSelectionWithinSingleLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4517
    "return true, if there is a selection and it is within a line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4518
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4519
    ^ selectionStartLine notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4520
      and:[ selectionStartLine == selectionEndLine ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4521
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4522
    "Modified: / 04-07-2006 / 18:42:59 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4523
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4524
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4525
hasSingleFullLineSelected
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4526
    ^ (selectionStartLine notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4527
      and:[selectionEndLine notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4528
      and:[selectionEndLine == (selectionStartLine+1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4529
      and:[selectionStartCol == 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4530
      and:[selectionEndCol == 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4531
    ]]]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4532
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4533
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4534
isInSelection:line col:aColNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4535
    "returns true, if the line, and column is in the selection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4536
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4537
    selectionStartLine isNil ifTrue:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4538
    selectionEndLine   isNil ifTrue:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4539
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4540
    (line between:selectionStartLine and:selectionEndLine) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4541
	^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4542
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4543
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4544
    line == selectionStartLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4545
	aColNr < selectionStartCol ifTrue:[^ false]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4546
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4547
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4548
    line == selectionEndLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4549
	(selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4550
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4551
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4552
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4553
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4554
makeSelectionVisible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4555
    "scroll to make the selection visible"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4556
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4557
    |line col|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4558
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4559
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4560
	expandingTop == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4561
	    line := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4562
	    col := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4563
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4564
	    line := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4565
	    col := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4566
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4567
	self makeLineVisible:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4568
	self makeColVisible:col inLine:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4569
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4570
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4571
    "Modified: 6.3.1996 / 13:53:45 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4572
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4573
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4574
selectAll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4575
    "select the whole text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4576
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4577
    self selectFromLine:1 col:1 toLine:(list size + 1) col:0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4578
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4579
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4580
selectFromCharacterPosition:pos1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4581
    "compute line/col from the character position and select the text up to the end"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4582
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4583
    |line1 col1 line2 col2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4584
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4585
    line1 := self lineOfCharacterPosition:pos1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4586
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4587
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4588
    line2 := (list size + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4589
    col2 := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4590
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4591
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4592
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4593
selectFromCharacterPosition:pos1 to:pos2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4594
    "compute line/col from character positions and select the text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4595
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4596
    |line1 col1 line2 col2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4597
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4598
    pos1 > pos2 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4599
	^ self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4600
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4601
    line1 := self lineOfCharacterPosition:pos1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4602
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4603
    col1 < 1 ifTrue:[ col1 := 1 ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4604
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4605
    line2 := self lineOfCharacterPosition:pos2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4606
    col2 := pos2 - (self characterPositionOfLine:line2 col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4607
    col2 < 1 ifTrue:[ col2 := 1 ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4608
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4609
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4610
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4611
selectFromLine:startLine col:startCol toLine:endLine col:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4612
    "select a piece of text and redraw that area"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4613
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4614
    self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4615
    startLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4616
	"new:"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4617
	endLine < startLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4618
	    ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4619
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4620
	(endLine == startLine and:[endCol < startCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4621
	    endCol ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4622
		self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4623
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4624
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4625
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4626
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4627
" old:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4628
	endLine < startLine ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4629
	(startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4630
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4631
	selectionStartLine := startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4632
	selectionStartCol := startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4633
	selectionEndLine := endLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4634
	selectionEndCol := endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4635
	self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4636
	self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4637
	self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4638
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4639
	(selectionStartLine == selectionEndLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4640
	    self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4641
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4642
	    selectionStartLine to:selectionEndLine do:[:lineNr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4643
		self redrawLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4644
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4645
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4646
	selectStyle := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4647
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4648
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4649
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4650
     |v|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4651
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4652
     v := TextView extent:300@300.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4653
     v contents:('smalltalk.rc' asFilename contentsOfEntireFile).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4654
     v openAndWait.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4655
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4656
     Delay waitForSeconds:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4657
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4658
     v selectFromLine:2 col:2 toLine:10 col:15
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4659
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4660
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4661
    "Modified: / 02-01-1997 / 13:32:25 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4662
    "Modified: / 17-04-2012 / 21:00:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4663
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4664
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4665
selectFromLine:startLine toLine:endLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4666
    "select a piece of text and redraw that area"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4667
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4668
    self selectFromLine:startLine col:1 toLine:endLine+1 col:0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4669
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4670
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4671
     |v|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4672
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4673
     v := TextView extent:300@300.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4674
     v contents:('smalltalk.rc' asFilename contentsOfEntireFile).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4675
     v openAndWait.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4676
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4677
     Delay waitForSeconds:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4678
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4679
     v selectFromLine:2 toLine:10
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4680
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4681
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4682
    "Modified: 29.4.1996 / 12:23:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4683
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4684
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4685
selectLine:selectLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4686
    "select one line and redraw it"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4687
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4688
    self selectFromLine:selectLine col:1 toLine:(selectLine + 1) col:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4689
    wordStartCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4690
    wordEndCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4691
    wordStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4692
    wordEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4693
    selectStyle := #line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4694
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4695
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4696
selectLineAtY:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4697
    "select the line at given y-(view-)coordinate"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4698
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4699
    |selectLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4700
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4701
    selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4702
    selectLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4703
	self selectLine:selectLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4704
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4705
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4706
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4707
selectLineWhereCharacterPosition:pos
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4708
    "select the line, where characterPosition pos is living.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4709
     The argument pos starts at 1 from the start of the text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4710
     and counts characters (i.e. can be used to convert from
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4711
     character position within a string to line-position in view)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4712
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4713
    self selectLine:(self lineOfCharacterPosition:pos)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4714
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4715
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4716
selectWordAtLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4717
    "select the word at given line/col"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4718
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4719
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4720
	wordAtLine:line col:col do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4721
	    :beginLine :beginCol :endLine :endCol :style |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4722
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4723
	    self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4724
	    selectStyle := style
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4725
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4726
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4727
    "Modified: 18.3.1996 / 17:30:38 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4728
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4729
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4730
selectWordAtX:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4731
    "select the word at given x/y-(view-)coordinate"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4732
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4733
    |selectVisibleLine selectLine selectCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4734
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4735
    selectStyle := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4736
    selectVisibleLine := self visibleLineOfY:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4737
    selectLine := self visibleLineToListLine:selectVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4738
    selectLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4739
	selectCol := self colOfX:x inVisibleLine:selectVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4740
	self selectWordAtLine:selectLine col:selectCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4741
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4742
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4743
    "Modified: / 8.9.1998 / 21:22:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4744
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4745
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4746
selectedInterval
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4747
    "return the selection-boundaries as interval"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4748
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4749
    ^ self selectionStartIndex to:(self selectionStopIndex - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4750
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4751
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4752
selection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4753
    "return the selection as a collection of (line-)strings.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4754
     If the selection ends in a full line, the last entry in the returned
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4755
     collection will be an empty string."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4756
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4757
    |sel|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4758
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4759
    selectionStartLine isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4760
    sel := self textFromLine:selectionStartLine col:(selectionStartCol max:1) toLine:selectionEndLine col:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4761
    sel notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4762
	(gc characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4763
	    sel := sel encodeFrom:gc characterEncoding into:#'iso10646-1'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4764
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4765
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4766
    ^ sel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4767
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4768
    "Modified (comment): / 25-01-2012 / 00:29:09 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4769
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4770
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4771
selectionAsString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4772
    "return the selection as a String (i.e. without emphasis)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4773
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4774
    |sel|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4775
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4776
    (sel := self selection) isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4777
    sel := sel collect:[:each| each isNil ifTrue:[nil] ifFalse:[each string]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4778
    ^ (sel asStringWithCRsFrom:1 to:(sel size) compressTabs:false withCR:false) string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4779
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4780
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4781
selectionChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4782
    "can be redefined for notification or special actions"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4783
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4784
    "Modified: / 17-04-2012 / 20:59:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4785
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4786
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4787
selectionEndCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4788
    ^ selectionEndCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4789
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4790
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4791
selectionEndLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4792
    ^ selectionEndLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4793
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4794
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4795
selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4796
    ^ selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4797
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4798
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4799
selectionStartLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4800
    ^ selectionStartLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4801
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4802
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4803
setPrimarySelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4804
    "can be redefined for notification or special actions"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4805
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4806
    self graphicsDevice notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4807
	"On X11, be nice and set the PRIMARY selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4808
	 (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4809
	self graphicsDevice setPrimaryText: self selectionAsString ownerView: self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4810
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4811
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4812
    "Created: / 17-04-2012 / 20:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4813
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4814
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4815
st80SelectMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4816
    st80SelectMode notNil ifTrue:[^ st80SelectMode].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4817
    ^ self class st80SelectMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4818
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4819
    "Created: / 03-07-2006 / 16:30:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4820
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4821
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4822
st80SelectMode:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4823
    st80SelectMode := aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4824
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4825
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4826
unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4827
    "unselect - if there was a selection redraw that area"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4828
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4829
    |startLine endLine startVisLine endVisLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4830
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4831
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4832
	startLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4833
	endLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4834
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4835
	self unselectWithoutRedraw.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4836
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4837
	"/ if the selection is not visible, we are done
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4838
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4839
	startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4840
	endLine < firstLineShown ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4841
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4842
	startLine < firstLineShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4843
	    startVisLine := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4844
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4845
	    startVisLine := self listLineToVisibleLine:startLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4846
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4847
	endLine >= (firstLineShown + nLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4848
	    endVisLine := nLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4849
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4850
	    endVisLine := self listLineToVisibleLine:endLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4851
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4852
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4853
	"/ if its only part of a line, just redraw what has to be
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4854
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4855
	(startLine == endLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4856
	    super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4857
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4858
	    self redrawFromVisibleLine:startVisLine to:endVisLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4859
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4860
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4861
    selectStyle := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4862
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4863
    "Modified: 29.5.1996 / 14:54:11 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4864
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4865
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4866
unselectWithoutRedraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4867
    "forget selection but do not redraw the selection area
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4868
     - can be done when the selected area is redrawn anyway or
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4869
     known to be invisible (however, redraw knows about that anyway)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4870
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4871
    selectionStartLine := selectionEndLine := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4872
    self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4873
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4874
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4875
validateNewSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4876
     "make certain that the selection is valid.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4877
      This is a dummy here, but subclasses (like single-line editFields)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4878
      may redefine it to limit the selection to a single line, or whatever."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4879
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4880
    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4881
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4882
    "Modified: 29.4.1996 / 12:32:08 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4883
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4884
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4885
!TextView methodsFor:'testing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4886
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4887
isTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4888
    "I am showing text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4889
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4890
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4891
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4892
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4893
!TextView class methodsFor:'documentation'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4894
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4895
version
5118
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  4896
    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.373.2.2 2014-07-31 12:09:55 stefan Exp $'
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4897
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4898
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4899
version_CVS
5118
62c457aa688e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  4900
    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.373.2.2 2014-07-31 12:09:55 stefan Exp $'
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4901
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4902
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4903
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4904
TextView initialize!