EditTextView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 05 Jun 2014 08:22:27 +0100
branchdelegated_gc_text-view-selection-refactoring
changeset 5087 001f9ac320b2
parent 5086 6f3514837c99
parent 5023 a18a03c5c572
child 5088 1c8a17975b43
permissions -rw-r--r--
Merged 6f3514837c99 and a18a03c5c572 (branch delegated_gc)
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
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libwidg' }"
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
TextView subclass:#EditTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'cursorLine cursorVisibleLine cursorCol cursorShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    16
		prevCursorState readOnly modifiedChannel fixedSize exceptionBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    17
		cursorFgColor cursorBgColor cursorNoFocusFgColor cursorType
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    18
		cursorTypeNoFocus typeOfSelection lastAction replacing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    19
		showMatchingParenthesis hasKeyboardFocus acceptAction lockUpdates
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    20
		tabMeansNextField autoIndent insertMode editMode trimBlankLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    21
		wordWrap replacementWordSelectStyle acceptChannel acceptEnabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    22
		st80Mode disableIfInvisible cursorMovementWhenUpdating learnMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    23
		learnedMacro cursorLineHolder cursorColHolder tabRequiresControl
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    24
		undoSupport lastStringFromReplaceForNextSearch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    25
		lastReplacementInfo completionSupport codeAspectHolder'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    26
	classVariableNames:'DefaultCursorForegroundColor DefaultCursorBackgroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    27
		DefaultCursorType DefaultCursorNoFocusForegroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    28
		DefaultCursorTypeNoFocus LastColumnNumberForSort Macros'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    29
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    30
	category:'Views-Text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    31
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    32
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    33
Object subclass:#EditAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    34
	instanceVariableNames:'userFriendlyInfo'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    35
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    36
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    37
	privateIn:EditTextView
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    40
EditTextView::EditAction subclass:#DeleteRange
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    41
	instanceVariableNames:'line1 col1 line2 col2'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    42
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    43
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    44
	privateIn:EditTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    45
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    46
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    47
EditTextView::EditAction subclass:#DeleteCharacters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    48
	instanceVariableNames:'line col1 col2'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    49
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    50
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    51
	privateIn:EditTextView
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    54
Object subclass:#EditMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    55
	instanceVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    56
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    57
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    58
	privateIn:EditTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    59
!
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
EditTextView::EditMode subclass:#InsertAndSelectMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    62
	instanceVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    63
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    64
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    65
	privateIn:EditTextView::EditMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    66
!
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
EditTextView::EditMode subclass:#InsertMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    69
	instanceVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    70
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    71
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    72
	privateIn:EditTextView::EditMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    73
!
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
EditTextView::EditMode subclass:#OverwriteMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    76
	instanceVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    77
	classVariableNames:'InsertMode OverwriteMode InsertAndSelectMode'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    78
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    79
	privateIn:EditTextView::EditMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    80
!
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
Query subclass:#ExecutingMacroQuery
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    83
	instanceVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    84
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    85
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    86
	privateIn:EditTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    87
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    88
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    89
Object subclass:#LastReplacementInfo
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    90
	instanceVariableNames:'lastReplacement lastStringToReplace lastReplaceWasMatch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    91
		lastReplaceIgnoredCase stillCollectingInput previousReplacements'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    92
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    93
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    94
	privateIn:EditTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    95
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    96
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    97
EditTextView::EditAction subclass:#PasteString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    98
	instanceVariableNames:'line col string selected'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    99
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   100
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   101
	privateIn:EditTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   102
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   103
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   104
EditTextView::EditAction subclass:#ReplaceCharacter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   105
	instanceVariableNames:'line col character'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   106
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   107
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   108
	privateIn:EditTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   109
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   110
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   111
EditTextView::EditAction subclass:#ReplaceCharacters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   112
	instanceVariableNames:'line col1 col2 characters'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   113
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   114
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   115
	privateIn:EditTextView
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   118
EditTextView::EditAction subclass:#ReplaceContents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   119
	instanceVariableNames:'text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   120
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   121
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   122
	privateIn:EditTextView
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   125
EditTextView::EditAction subclass:#ReplaceLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   126
	instanceVariableNames:'line text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   127
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   128
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   129
	privateIn:EditTextView
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   132
EditTextView::EditAction subclass:#ReplaceLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   133
	instanceVariableNames:'line text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   134
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   135
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   136
	privateIn:EditTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   137
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   138
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   139
!EditTextView class methodsFor:'documentation'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   140
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   141
copyright
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   142
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   143
 COPYRIGHT (c) 1989 by Claus Gittinger
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   144
              All Rights Reserved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   145
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   146
 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
   147
 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
   148
 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
   149
 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
   150
 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
   151
 hereby transferred.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   152
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   153
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   154
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   155
documentation
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   156
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   157
    a view for editable text - adds editing functionality to TextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   158
    Also, it adds accept functionality, and defines a new actionBlock:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   159
    acceptAction to be performed for accept
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
    If used with a model, this is informed by sending it a changeMsg with
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   162
    the current contents as argument.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   163
    (however, it is possible to define both changeMsg and acceptAction)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   164
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   165
    Please read the historic notice in the ListView class.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   166
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   167
    [Instance variables:]
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
        cursorLine              <Number>        line where cursor sits (1..)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   170
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   171
        cursorVisibleLine       <Number>        visible line where cursor sits (1..nLinesShown)
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
        cursorCol               <Number>        col where cursor sits (1..)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   174
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   175
        cursorShown             <Boolean>       true, if cursor is currently shown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   176
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   177
        readOnly                <Boolean>       true, if text may not be edited
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
        modifiedChannel         <ValueHolder>   holding true, if text has been modified.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   180
                                                cleared on accept.
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
        acceptChannel           <ValueHolder>   holding true, if text has been accepted.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   183
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   184
        fixedSize               <Boolean>       true, if no lines may be added/removed
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   185
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   186
        exceptionBlock          <Block>         block to be evaluated when readonly text is about to be modified
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   187
                                                if it returns true, the modification will be done anyway.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   188
                                                if it returns anything else, the modification is not done.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   189
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   190
        cursorFgColor           <Color>         color used for cursor drawing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   191
        cursorBgColor           <Color>         color used for cursor drawing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   192
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   193
        cursorType              <Symbol>        how the cursor is drawn; currently implemented
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   194
                                                are #none, #block (solid-block cursor), #ibeam
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   195
                                                (vertical bar at insertion point)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   196
                                                and #caret (caret below insertion-point).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   197
                                                see cursorType: for an up-to-date list.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   198
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   199
        cursorTypeNoFocus       <Symbol>        like above, if view has no focus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   200
                                                nil means: hide the cursor.
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
        undoAction              <Block>         block which undoes last cut, paste or replace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   203
                                                (not yet fully implemented)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   204
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   205
        typeOfSelection         <Symbol>        #paste, if selection created by paste, nil otherwise
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   206
                                                this affects the next keyPress: if #paste it does not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   207
                                                replace; otherwise it replaces the selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   208
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   209
        lastCut                 <String>        last cut or replaced string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   210
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   211
        lastReplacementInfo     <LastReplacementInfo>        holds the information about the last replace action
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   212
                                                             lastStringToReplace is the string to be replaced by lastReplacement
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   213
                                                             lastReplacement is the string to replace lastStringToReplace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   214
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   215
        lastStringFromReplaceForNextSearch   <String>        string to be taken be the next search action 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   216
                                                             (cleared after a new selection)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   217
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   218
        replacing               <Boolean>       true if entered characters replace last selection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   219
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   220
        showMatchingParenthesis <Boolean>       if true, shows matching parenthesis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   221
                                                when entering one; this is the default.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   222
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   223
        hasKeyboardFocus        <Boolean>       true if this view has the focus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   224
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   225
        acceptAction            <Block>         accept action - evaluated passing the contents as
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   226
                                                argument
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   227
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   228
        tabMeansNextField       <Boolean>       if true, Tab is ignored as input and shifts keyboard
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   229
                                                focus to the next field. For editTextViews, this is false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   230
                                                by default (i.e. tabs can be entered into the text).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   231
                                                For some subclasses (inputFields), this may be true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   232
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   233
        trimBlankLines          <Boolean>       if true, trailing blanks are
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   234
                                                removed when editing.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   235
                                                Default is true.
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
        wordWrap                <Boolean>       Currently not used.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   238
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   239
        lockUpdates             <Boolean>       internal, private
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   240
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   241
        prevCursorState         <Boolean>       temporary, private
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   242
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   243
        cursorMovementWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   244
                                <Symbol>        defines where the cursor is to be positioned if the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   245
                                                model changes its value by some outside activity
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   246
                                                (i.e. not by user input into the field).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   247
                                                Can be one of:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   248
                                                    #keep / nil     -> stay where it was
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   249
                                                    #endOfText      -> cursor to the end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   250
                                                    #endOfLine      -> stay in the line, but move to end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   251
                                                    #beginOfText    -> cursor to the beginning
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   252
                                                    #beginOfLine    -> stay in the line, but move to begin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   253
                                                The default is #beginOfText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   254
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
        dropTarget              <DropTarget|nil> drop operation descriptor or nil (drop disabled)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   258
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
    userPreference values:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   261
        userPreferences.st80EditMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   262
                                <Boolean>       if true, cursor positioning is
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   263
                                                done as in vi or ST80; i.e.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   264
                                                wysiwyg mode is somewhat relaxed,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   265
                                                in that the cursor cannot be
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   266
                                                positioned behind a lines end.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   267
                                                This is not yet completely implemented.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   268
    used globals:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   269
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   270
        DeleteHistory           <Text>          last 1000 lines of deleted text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   271
                                                (but only if this variable exists already)
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
    [styleSheet parameters:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   274
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   275
        textCursorForegroundColor <Color>          cursor fg color; default: text background
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   276
        textCursorBackgroundColor <Color>          cursor bg color; default: text foreground
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   277
        textCursorNoFocusForegroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   278
                                  <Color>          cursor fg color if no focus; default: cursor fg color
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   279
        textCursorType            <Symbol>         cursor type; default:  #block
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   280
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   281
    [author:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   282
        Claus Gittinger
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   283
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   284
    [see also:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   285
        CodeView Workspace TextView ListView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   286
        EditField
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   287
"
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
examples
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   291
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   292
  non MVC operation:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   293
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   294
    basic setup:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   295
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   296
        |top textView|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   297
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   298
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   299
        top extent:300@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   300
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   301
        textView := EditTextView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   302
        textView 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
   303
        top addSubView:textView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   304
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   305
        textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   306
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   307
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   308
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   309
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   310
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   311
    with vertical scrollbar:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   312
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   313
        |top scrollView textView|
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
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   316
        top extent:300@200.
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
        scrollView := ScrollableView for:EditTextView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   319
        textView := scrollView scrolledView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   320
        scrollView 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
   321
        top addSubView:scrollView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   322
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   323
        textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
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
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   326
                                                                        [exEnd]
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
    with horizontal & vertical scrollbars:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   330
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   331
        |top scrollView textView|
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
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   334
        top extent:300@200.
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
        scrollView := HVScrollableView for:EditTextView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   337
        textView := scrollView scrolledView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   338
        scrollView 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
   339
        top addSubView:scrollView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   340
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   341
        textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   342
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   343
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   344
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   345
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   346
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   347
    set the action for accept:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   348
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   349
        |top textView|
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
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   352
        top extent:300@200.
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
        textView := EditTextView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   355
        textView 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
   356
        top addSubView:textView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   357
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   358
        textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   359
        textView acceptAction:[:contents |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   360
                                Transcript showCR:'will not overwrite the file with:'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   361
                                Transcript showCR:contents asString
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
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   364
                                                                        [exEnd]
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   368
    non-string (text) items:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   369
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   370
        |top textView list|
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
        list := '/etc/hosts' asFilename contentsOfEntireFile asStringCollection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   373
        1 to:list size by:2 do:[:nr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   374
            list at:nr put:(Text string:(list at:nr)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   375
                                 emphasis:(Array with:#bold with:(#color->Color red)))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   376
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   377
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   378
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   379
        top extent:300@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   380
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   381
        textView := EditTextView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   382
        textView 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
   383
        top addSubView:textView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   384
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   385
        textView contents:list.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   386
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   387
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   388
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   389
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   390
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   391
  MVC operation:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   392
    (the examples model here is a plug simulating a real model;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   393
     real world applications would not use a plug ..)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   394
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   395
        |top textView model|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   396
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   397
        model := Plug new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   398
        model respondTo:#accepted:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   399
                   with:[:newContents |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   400
                                Transcript showCR:'will not overwrite the file with:'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   401
                                Transcript showCR:newContents asString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   402
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   403
        model respondTo:#getList
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   404
                   with:['/etc/hosts' asFilename contentsOfEntireFile].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   405
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   406
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   407
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   408
        top extent:300@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   409
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   410
        textView := EditTextView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   411
        textView 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
   412
        top addSubView:textView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   413
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   414
        textView listMessage:#getList;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   415
                 model:model;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   416
                 changeMessage:#accepted:;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   417
                 aspect:#list.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   418
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   419
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   420
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   421
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   422
    two textViews on the same model:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   423
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   424
        |top1 textView1 top2 textView2 model currentContents|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   425
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   426
        model := Plug new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   427
        model respondTo:#accepted:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   428
                   with:[:newContents |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   429
                                Transcript showCR:'accepted:'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   430
                                Transcript showCR:newContents asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   431
                                currentContents := newContents.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   432
                                model changed:#contents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   433
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   434
        model respondTo:#getList
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   435
                   with:[Transcript showCR:'query'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   436
                         currentContents].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   437
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   438
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   439
        top1 := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   440
        top1 extent:300@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   441
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   442
        textView1 := EditTextView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   443
        textView1 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
   444
        top1 addSubView:textView1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   445
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   446
        textView1 listMessage:#getList;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   447
                  model:model;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   448
                  aspect:#contents;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   449
                  changeMessage:#accepted:.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   450
        top1 open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   451
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   452
        top2 := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   453
        top2 extent:300@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   454
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   455
        textView2 := EditTextView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   456
        textView2 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
   457
        top2 addSubView:textView2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   458
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   459
        textView2 listMessage:#getList;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   460
                  model:model;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   461
                  aspect:#contents;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   462
                  changeMessage:#accepted:.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   463
        top2 open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   464
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   465
"
4978
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   466
!
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   467
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   468
selection_and_cursor_movement
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   469
"
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   470
Changes done to implement 'standard' behaviour (that's how vast majority of widgets used in todays desktops behaves)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   471
as opposed to 'traditional' which is what how it was in St/X 'ever since'
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   472
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   473
* Numerous off-by-one bugs
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   474
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   475
* Extending selection by dragging:
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   476
  Scenario:
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   477
    1. Select & drag to expand beggining of the selection (i.e., drag from 'end' to 'beggining'
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   478
    2. Stop dragging
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   479
    3. Press Shift-Left / Shift-Right (to refine selection)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   480
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   481
    Traditional ST/X: end of selection is moved
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   482
    Standard:  beginning of selection is moved
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   483
      (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   484
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   485
* Extending selection by Shift-Home / Shift-End
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   486
  Scenario:
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   487
    1. Position cursor in the middle of the line
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   488
    2. Press Shift-Home (line for beginning should be selected)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   489
    3. Press Shift-Right (to refine selection)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   490
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   491
    Traditional ST/X: end of selection is moved
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   492
    Standard:  beginning of selection is moved
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   493
      (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   494
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   495
* Selection flip by Shift-Home / Shift-End
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   496
  Scenario A:
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   497
    1. Position cursor in the middle of the line to column C
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   498
    2. Press Shift-Home (line from beginning should be selected)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   499
    2. Press Shift-End
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   500
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   501
    Traditional ST/X: end of selection is moved so whole line is selected
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   502
    Standard: Selection 'flips' so part of line from column C to the end is selected
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   503
      (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   504
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   505
  Scenario B:
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   506
    1. Position cursor in the middle of the line to column C
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   507
    2. Press Shift-End (column C to the end of line should be selected)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   508
    2. Press Shift-Home
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   509
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   510
    Traditional ST/X: beginning of selection is moved so whole line is selected
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   511
    Standard: Selection 'flips' so part of line from the beginning to column C is selected
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   512
      (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   513
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   514
  NOTE: This could be controlled by 
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   515
    UserPreferences current selectionExtensionMode
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   516
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   517
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   518
* Extending selection with Ctrl-Shift-Left / Ctrl-Shift-Right
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   519
  Scenario A:
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   520
    1. Position cursor in the middle of the line to column C
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   521
    2. Select word
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   522
    3. Press Ctrl-Shift-Right, Ctrl-Shift-Right
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   523
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   524
    Traditional ST/X: nothing happens at all
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   525
    Standard: Selection is extended to include a space (first press) and a word right to previously selected one
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   526
      (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   527
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
   528
"
5023
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   531
!EditTextView class methodsFor:'defaults'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   532
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   533
defaultCompletionSupportClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   534
    ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   535
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   536
    "Created: / 26-09-2013 / 17:59:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   537
!
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
st80Mode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   540
    "return true, if the st80 editing mode is turned on.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   541
     This setting affects the behavior of the cursor, when positioned
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   542
     beyond the end of a line or the end of the text."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   543
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   544
    ^ UserPreferences current st80EditMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   545
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   546
   "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   547
    EditTextView st80Mode:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   548
    EditTextView st80Mode:false
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
    "Modified: / 16.1.1998 / 22:54:57 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   554
st80Mode:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   555
    "turns on/off st80 behavior, where the cursor cannot be positioned
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   556
     beyond the end of a line or the last line"
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
    UserPreferences current st80EditMode:aBoolean.
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
    EditTextView st80Mode:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   562
    EditTextView st80Mode:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   563
   "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   564
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   565
    "Modified: / 16.1.1998 / 22:55:19 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   566
!
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
updateStyleCache
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   569
    "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
   570
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   571
    <resource: #style (#'textCursor.foregroundColor' #'textCursor.backgroundColor'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   572
                       #'textCursor.noFocusForegroundColor'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   573
                       #'textCursor.type'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   574
                       #'textCursor.typeNoFocus'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   575
                       #'editText.st80Mode')>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   576
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   577
    DefaultCursorForegroundColor := StyleSheet colorAt:'textCursor.foregroundColor'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   578
    DefaultCursorBackgroundColor := StyleSheet colorAt:'textCursor.backgroundColor'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   579
    DefaultCursorNoFocusForegroundColor := StyleSheet colorAt:'textCursor.noFocusForegroundColor'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   580
    DefaultCursorType := StyleSheet at:'textCursor.type' default:#block.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   581
    DefaultCursorTypeNoFocus := StyleSheet at:'textCursor.typeNoFocus'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   582
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 updateStyleCache
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
    "Modified: / 20.5.1998 / 04:27:41 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   588
! !
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
!EditTextView class methodsFor:'specs'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   591
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   592
searchReplaceDialogSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   593
    "This resource specification was automatically generated
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   594
     by the UIPainter of ST/X."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   595
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   596
    "Do not manually edit this!! If it is corrupted,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   597
     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
   598
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   599
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   600
     UIPainter new openOnClass:DAPASX::ProjectEditorTextView andSelector:#searchReplaceDialogSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   601
    "
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
    <resource: #canvas>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   604
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   605
    ^
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   606
     #(FullSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   607
        name: searchReplaceDialogSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   608
        window:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   609
       (WindowSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   610
          label: 'String Search and Replace'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   611
          name: 'String Search and Replace'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   612
          min: (Point 283 196)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   613
          max: (Point 283 196)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   614
          bounds: (Rectangle 0 0 279 192)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   615
        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   616
        component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   617
       (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   618
          collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   619
           (LabelSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   620
              label: 'Search Pattern:'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   621
              name: 'label'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   622
              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
   623
              level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   624
              translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   625
              adjust: left
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   626
            )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   627
           (ComboBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   628
              name: 'patternComboBox'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   629
              layout: (LayoutFrame 3 0.0 26 0 -3 1.0 48 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   630
              tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   631
              model: searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   632
              immediateAccept: false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   633
              acceptOnLeave: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   634
              acceptOnReturn: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   635
              acceptOnTab: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   636
              acceptOnLostFocus: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   637
              acceptOnPointerLeave: false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   638
              autoSelectInitialText: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   639
              comboList: patternList
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
           (ComboBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   642
              name: 'replaceComboBox'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   643
              layout: (LayoutFrame 3 0.0 76 0 -3 1.0 98 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   644
              tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   645
              model: replacePattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   646
              immediateAccept: false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   647
              acceptOnLeave: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   648
              acceptOnReturn: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   649
              acceptOnTab: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   650
              acceptOnLostFocus: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   651
              acceptOnPointerLeave: false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   652
              autoSelectInitialText: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   653
              comboList: patternList
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
           (CheckBoxSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   656
              label: 'Ignore Case'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   657
              name: 'ignoreCaseCheckBox'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   658
              layout: (LayoutFrame 3 0.0 107 0 -3 1.0 130 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   659
              level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   660
              tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   661
              model: ignoreCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   662
              translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   663
            )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   664
           (VariableVerticalPanelSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   665
              name: 'VariableVerticalPanel1'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   666
              layout: (LayoutFrame 0 0 -64 1 0 1 -4 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   667
              component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   668
             (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   669
                collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   670
                 (HorizontalPanelViewSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   671
                    name: 'HorizontalPanel1'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   672
                    level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   673
                    horizontalLayout: fitSpace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   674
                    verticalLayout: center
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   675
                    horizontalSpace: 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   676
                    verticalSpace: 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   677
                    ignoreInvisibleComponents: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   678
                    reverseOrderIfOKAtLeft: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   679
                    component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   680
                   (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   681
                      collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   682
                       (ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   683
                          label: 'Replace'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   684
                          name: 'replaceButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   685
                          level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   686
                          translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   687
                          tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   688
                          model: replaceAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   689
                          extent: (Point 134 21)
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
                       (ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   692
                          label: 'Replace All'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   693
                          name: 'replaceAllButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   694
                          level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   695
                          borderWidth: 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   696
                          translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   697
                          tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   698
                          model: replaceAllAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   699
                          extent: (Point 134 21)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   700
                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   701
                       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   702
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   703
                    )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   704
                  )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   705
                 (HorizontalPanelViewSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   706
                    name: 'horizontalPanelView'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   707
                    level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   708
                    horizontalLayout: fitSpace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   709
                    verticalLayout: center
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   710
                    horizontalSpace: 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   711
                    verticalSpace: 3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   712
                    ignoreInvisibleComponents: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   713
                    reverseOrderIfOKAtLeft: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   714
                    component:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   715
                   (SpecCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   716
                      collection: (
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   717
                       (ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   718
                          label: 'Cancel'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   719
                          name: 'cancelButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   720
                          level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   721
                          translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   722
                          tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   723
                          model: cancel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   724
                          extent: (Point 88 21)
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
                       (ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   727
                          label: 'Prev'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   728
                          name: 'prevButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   729
                          level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   730
                          translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   731
                          tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   732
                          model: prevAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   733
                          extent: (Point 89 21)
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
                       (ActionButtonSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   736
                          label: 'Next'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   737
                          name: 'nextButton'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   738
                          level: 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   739
                          borderWidth: 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   740
                          translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   741
                          tabable: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   742
                          model: nextAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   743
                          isDefault: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   744
                          extent: (Point 88 21)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   745
                        )
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   748
                    )
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
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
              handles: (Any 0.5 1.0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   754
            )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   755
           (LabelSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   756
              label: 'Replace By:'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   757
              name: 'ReplaceLabel'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   758
              layout: (LayoutFrame 1 0.0 53 0 -1 1.0 70 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   759
              level: 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   760
              translateLabel: true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   761
              adjust: left
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   765
        )
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   768
    "Modified: / 11-10-2006 / 21:05:09 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   769
! !
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
!EditTextView methodsFor:'Compatibility-ST80'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   772
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   773
autoAccept:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   774
    "ignored for now"
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
    "Created: / 5.6.1998 / 15:30:32 / cg "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   777
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   778
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   779
continuousAccept:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   780
    "ignored for now"
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
    "Created: / 19.6.1998 / 00:03:49 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   783
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   784
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   785
cutSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   786
    self cut
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: / 31.10.1997 / 03:29:50 / 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
deselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   792
    "remove the selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   793
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   794
    ^ self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   795
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   796
    "Created: / 19.6.1998 / 02:41:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   797
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   798
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   799
enabled:aBoolean
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
    self readOnly:aBoolean not
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
    "Created: / 30.3.1999 / 15:10:23 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   804
    "Modified: / 30.3.1999 / 15:10:53 / stefan"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   807
find:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   808
    self searchFwd:pattern ifAbsent:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   809
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   810
    "Created: / 29.1.1999 / 19:09:42 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   811
    "Modified: / 29.1.1999 / 19:10:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   812
!
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
insert:aString at:aCharacterPosition
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   815
    "insert a string at aCharacterPosition."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   816
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   817
    |line col|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   818
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   819
    line := self lineOfCharacterPosition:aCharacterPosition.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   820
    col := aCharacterPosition - (self characterPositionOfLine:line col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   821
    col < 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   822
        col := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   823
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   824
    self insertString:aString atLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   825
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
     |top v|
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
     top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   830
     top extent:300@300.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   831
     v := EditTextView origin:0.0@0.0 corner:1.0@1.0 in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   832
     top openAndWait.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   833
     v contents:'1234567890\1234567890\1234567890\' withCRs.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   834
     v insert:'<- hello there' at:5.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   835
    "
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
    "Modified: / 5.4.1998 / 17:20:08 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   838
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   839
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   840
insertAndSelect:aString at:aCharacterPosition
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   841
    "insert a selected string at aCharacterPosition."
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
    |line col|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   844
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   845
    line := self lineOfCharacterPosition:aCharacterPosition.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   846
    col := (aCharacterPosition - (self characterPositionOfLine:line col:1) + 1) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   847
    self insertString:aString atLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   848
    self selectFromLine:line col:col toLine:line col:col + aString size - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   849
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   850
     |v|
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
     v := EditTextView new openAndWait.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   853
     v contents:'1234567890\1234567890\1234567890\' withCRs.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   854
     v insertAndSelect:'<- hello there' at:5.
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
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   857
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   858
pasteSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   859
    self paste
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   860
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   861
    "Created: / 31.10.1997 / 03:28:53 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   864
replaceSelectionWith:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   865
    ^ self replaceSelectionBy:aString
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
    "Created: / 19.6.1998 / 02:42:32 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   868
!
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
selectAt:pos
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   871
    "move the cursor before cursorPosition."
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
    self cursorToCharacterPosition:pos
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   874
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   875
    "Modified: / 19.6.1998 / 02:41:28 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   876
    "Created: / 19.6.1998 / 02:43:39 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   879
textHasChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   880
    ^ self modified
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   881
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   882
    "Created: / 19.6.1998 / 00:09:43 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   885
textHasChanged:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   886
    "ST-80 compatibility: set/clear the modified flag."
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
    self modified:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   889
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   890
    "Created: / 5.2.2000 / 17:07:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   891
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   892
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   893
!EditTextView methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   894
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   895
codeAspect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   896
    | codeAspect app |
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
    codeAspect := codeAspectHolder value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   899
    codeAspect notNil ifTrue:[^codeAspect].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   900
    self editedMethod notNil ifTrue:[^SyntaxHighlighter codeAspectMethod].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   901
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   902
    "/ Applications should set it explictly, however, to make it behavinh like
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   903
    "/ CodeView2, I kept fetching code here for now.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   904
    ^((app := self topView application) notNil and:[app respondsTo: #codeAspect])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   905
        ifTrue:[app codeAspect]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   906
        ifFalse:[nil]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   907
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   908
    "Created: / 27-09-2013 / 09:53:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   911
codeAspect: aSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   912
    codeAspectHolder value: aSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   913
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   914
    "Created: / 27-09-2013 / 09:50:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   917
completionSupport
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   918
    ^ completionSupport
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   919
!
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
completionSupport:anEditTextViewCompletionSupport
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   922
    completionSupport := anEditTextViewCompletionSupport.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   925
completionSupportClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   926
    ^ self class defaultCompletionSupportClass
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
    "Created: / 26-09-2013 / 17:54:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   929
!
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
editedClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   932
    |cm|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   933
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   934
    cm := self editedMethodOrClass.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   935
    cm isBehavior ifTrue:[^ cm].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   936
    cm isMethod ifTrue:[^ cm mclass].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   937
    ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   938
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   939
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   940
editedLanguage
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   941
    ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   942
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   943
    "Created: / 18-09-2013 / 14:16:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   944
!
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
editedLanguage: aProgrammingLanguage
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   947
    "Sets the edited language. Only defined here to make it polymorph with Workspace"
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
    "Created: / 27-09-2013 / 10:15:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   950
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   951
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   952
editedMethod
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   953
    |cm|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   954
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   955
    cm := self editedMethodOrClass.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   956
    cm isMethod ifTrue:[^ cm].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   957
    cm isBehavior ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   958
    ^ nil
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   961
editedMethodOrClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   962
    ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   963
!
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
editedMethodOrClass: methodOrClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   966
    "Sets the edited method or class. Only defined here to make it polymorph with Workspace"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   967
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   968
    "Created: / 27-09-2013 / 10:10:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   969
!
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
hasSelectionOrTextInCursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   972
    ^ (self selectionOrTextOfCursorLine:false) notNil
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   975
selectionOrTextOfCursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   976
    ^ self selectionOrTextOfCursorLine:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   977
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   978
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   979
selectionOrTextOfCursorLine:doSelect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   980
    |sel lNr line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   981
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   982
    sel := self selectionAsString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   983
    sel notNil ifTrue:[^ sel].
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
    lNr := self cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   986
    line := self listAt:lNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   987
    line notEmptyOrNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   988
        doSelect ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   989
            self selectLine:lNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   990
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   991
        ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   992
    ].
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
    ^ nil
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
!EditTextView methodsFor:'accessing-behavior'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   998
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   999
acceptAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1000
    "return the action to be performed on accept (or nil)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1001
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1002
    ^ acceptAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1003
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1004
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1005
acceptAction:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1006
    "set the action to be performed on accept"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1007
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1008
    acceptAction := aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1009
!
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
acceptChannel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1012
    "return the valueHolder holding true if text was accepted.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1013
     By placing a true into this channel, an accept can also be forced."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1014
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1015
    ^ acceptChannel
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
    "Modified: / 30.1.1998 / 14:17:11 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1020
acceptChannel:aValueHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1021
    "set the valueHolder holding true if text was accepted.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1022
     By placing a true into this channel, an accept can also be forced."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1024
    |prev|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1025
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1026
    prev := acceptChannel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1027
    acceptChannel := aValueHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1028
    self setupChannel:aValueHolder for:nil withOld:prev
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
    "Created: / 30.1.1998 / 14:51:09 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1031
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1032
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1033
acceptEnabled:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1034
    "enable/disable accept. This greys the corresponding item in the menu"
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
    acceptEnabled := aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1037
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1038
    "Created: 7.3.1997 / 11:04:34 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1039
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1040
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1041
accepted
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1042
    "return true if text was accepted"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1043
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1044
    ^ acceptChannel value
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
    "Created: 14.2.1997 / 16:43:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1047
!
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
accepted:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1050
    "set/clear the accepted flag.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1051
     This may force my current contents to be placed into my model."
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
    acceptChannel value:aBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1054
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1055
    "Created: / 14.2.1997 / 16:44:01 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1056
    "Modified: / 30.1.1998 / 14:20:15 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1059
autoIndent:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1060
    autoIndent := aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1061
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1062
    "Created: 5.3.1996 / 14:37:50 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1063
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1064
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1065
codeAspectHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1066
    ^ codeAspectHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1067
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1068
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1069
codeAspectHolder:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1070
    codeAspectHolder := something.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1073
cursorMovementWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1074
    "return what is be done with the cursor,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1075
     when I get a new text (via the model or the #contents/#list)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1076
     Allowed arguments are:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1077
        #keep / nil     -> stay where it was
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1078
        #endOfText      -> position cursor to the end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1079
        #beginOfText    -> position cursor to the beginning
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1080
        #endOfLine      -> position cursor to the current lines end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1081
        #beginOfLine    -> position cursor to the current lines start
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1082
     The default is #beginOfText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1083
     This may be useful for fields which get new values assigned from
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1084
     the program (i.e. not from the user)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1085
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1086
    ^ cursorMovementWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1087
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1088
    "Modified: 16.12.1995 / 16:27:55 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1089
!
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
cursorMovementWhenUpdating:aSymbolOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1092
    "define what should be done with the cursor,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1093
     when I get a new text (via the model or the #contents/#list)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1094
     Allowed arguments are:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1095
        #keep / nil     -> stay where it was
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1096
        #endOfText      -> position cursor to the end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1097
        #beginOfText    -> position cursor to the beginning
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1098
        #endOfLine      -> position cursor to the current lines end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1099
        #beginOfLine    -> position cursor to the current lines start
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1100
     The default is #beginOfText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1101
     This may be useful for fields which get new values assigned from
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1102
     the program (i.e. not from the user)"
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
    cursorMovementWhenUpdating := aSymbolOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1105
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1106
    "Modified: 16.12.1995 / 16:27:55 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1107
!
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
disableIfInvisible:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1110
    disableIfInvisible := aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1111
!
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
dontReplaceSelectionOnInput
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1114
    "remember that the current selection was created by a paste operation
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1115
     (as opposed to an explicit selection by the user).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1116
     This selection will not be replaced by followup user input,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1117
     so multiple pastes will be possible."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1118
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1119
    typeOfSelection := #paste
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1122
editModeHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1123
    ^ editMode.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1124
!
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
editModeInsert
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1127
    editMode value:EditMode insertMode
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
editModeInsertAndSelect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1131
    editMode value:EditMode insertAndSelectMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1132
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1133
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1134
editModeOverwrite
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1135
    editMode value:EditMode overwriteMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1136
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1137
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1138
exceptionBlock:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1139
    "define the action to be triggered when user tries to modify
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1140
     readonly text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1141
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1142
    exceptionBlock := aBlock
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1145
fixedSize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1146
    "make the texts size fixed (no lines may be added).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1147
     OBSOLETE: use readOnly"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1148
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1149
    <resource:#obsolete>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1150
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1151
    |menu|
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
    self obsoleteMethodWarning:'use #readOnly:'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1154
    readOnly == true ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1155
        readOnly := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1156
        (menu := self middleButtonMenu) notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1157
            menu disableAll:#(cut paste replace indent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1158
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1159
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1160
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1161
    "Modified: 14.2.1997 / 17:35:24 / cg"
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
insertMode:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1165
    editMode value:(aBoolean ifTrue:[EditMode insertMode] ifFalse:[EditMode overwriteMode])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1166
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1167
    "Created: 6.3.1996 / 12:24:05 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1170
insertModeHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1171
    ^ BlockValue
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1172
        with:[:m | m isInsertMode]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1173
        argument:(editMode).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1174
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1175
    "Modified: / 08-03-2007 / 22:58:37 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1176
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1177
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1178
isInInsertMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1179
    ^ editMode value isInsertMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1180
!
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
isReadOnly
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1183
    "return true, if the text is readonly."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1184
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1185
    ^ readOnly value
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
    "Modified: 14.2.1997 / 17:35:56 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1188
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1189
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1190
modeLabelHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1191
    "a valueHolder, which contains 'L' (learnMode), I (insertMode) or empty"
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
    ^ BlockValue
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1194
        with:[:e :l |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1195
            self isReadOnly ifTrue:[
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
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1198
                l ifTrue:[ 'L' allBold colorizeAllWith:Color red]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1199
                  ifFalse:[ e infoPrintString]]]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1200
        argument:(self editModeHolder)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1201
        argument:(self learnModeHolder).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1202
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1203
    "Modified: / 08-03-2007 / 22:58:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1204
!
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
modified
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1207
    "return true if text was modified"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1208
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1209
    ^ modifiedChannel value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1210
!
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
modified:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1213
    "set/clear the modified flag"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1214
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1215
    modifiedChannel value:aBoolean
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
    "Modified: 14.2.1997 / 16:44:05 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1218
!
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
modifiedChannel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1221
    "return the valueHolder holding true if text was modified"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1222
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1223
    ^ modifiedChannel
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1226
modifiedChannel:aValueHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1227
    "set the valueHolder holding true if text was modified"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1228
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1229
    |prev|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1230
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1231
    prev := modifiedChannel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1232
    modifiedChannel := aValueHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1233
    self setupChannel:aValueHolder for:nil withOld:prev
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1234
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1235
    "Created: / 30.1.1998 / 14:51:32 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1236
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1237
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1238
readOnly
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1239
    "make the text readonly.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1240
     Obsolete because it is obfuscating (looks like a getter)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1241
     - use #readOnly:"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1242
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1243
    <resource:#obsolete>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1244
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1245
    self obsoleteMethodWarning:'use #readOnly:'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1246
    self readOnly:true.
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
    "Modified: / 14-02-1997 / 17:35:56 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1249
    "Modified (comment): / 02-08-2013 / 16:46:57 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1252
readOnly:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1253
    "make the text readonly (aBoolean == true) or writable (aBoolean == false).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1254
     The argument may also be a valueHolder."
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
    readOnly := aBoolean
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
    "Created: 14.2.1997 / 17:35:39 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1259
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1260
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1261
reallyModifiedChannel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1262
    "return the valueHolder holding true if text was really modified.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1263
     For compatibility with views which use the modified flag for syntax highlighting."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1264
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1265
    ^ self modifiedChannel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1266
!
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
st80Mode:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1269
    "set/clear the st80Mode flag.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1270
     If on, the cursor wraps at the line end (like in vi or st80);
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1271
     if off, we have the Rand-editor behavior (random access)"
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
    st80Mode := aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1274
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1275
    "Created: / 09-11-2010 / 13:55:50 / 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
tabMeansNextField:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1279
    "set/clear tabbing to the next field.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1280
     If true, Tab is ignored and shifts the keyboard focus.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1281
     If false, tabs can be entered into the text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1282
     The default is true for editTextView, false for single-line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1283
     input fields."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1284
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1285
    tabMeansNextField := aBoolean
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
tabRequiresControl
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1289
    "returns true, if a focus tabbing requires a control-key to be pressed.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1290
     The default is true for editTextView, false for other widgets,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1291
     to allow for easier text entry"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1292
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1293
    ^ tabRequiresControl
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
tabRequiresControl:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1297
    "controls if a focus tabbing requires a control-key to be pressed.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1298
     The default is true for editTextView, false for other widgets,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1299
     to allow for easier text entry"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1300
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1301
    tabRequiresControl := aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1302
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1303
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1304
!EditTextView methodsFor:'accessing-contents'!
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
at:lineNr basicPut:aLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1307
    "change a line without change notification"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1308
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1309
    (self at:lineNr) = aLine ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1310
        super at:lineNr put:aLine.
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
!
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
at:lineNr put:aLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1315
    (self at:lineNr) = aLine ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1316
        super at:lineNr put:aLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1317
        self textChanged
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
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1320
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1321
characterAfterCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1322
    "return the character one after the cursor - space if beyond line."
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
    ^ self characterAtLine:cursorLine col:cursorCol+1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1325
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1326
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1327
characterBeforeCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1328
    "return the character to the left of cursor - space if beyond line, nil if at the beginning."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1329
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1330
    cursorCol == 1 ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1331
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1332
    ^ self characterAtLine:cursorLine col:cursorCol-1
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
    "Created: / 17.6.1998 / 15:16:41 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1335
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1336
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1337
characterUnderCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1338
    "return the character under the cursor - space if beyond line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1339
     For non-block cursors, this is the character immediately to the right
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1340
     of the insertion-bar or caret."
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
    ^ self characterAtLine:cursorLine col:cursorCol
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
contents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1346
    "return the contents as a String or Text (i.e. with emphasis)"
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
    list isNil ifTrue:[^ ''].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1349
    self removeTrailingBlankLines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1350
    ^ super contents.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1351
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1352
    "Modified: / 04-07-2006 / 19:22:32 / fm"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1355
contents:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1356
    self contents:something keepUndoHistory:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1357
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1358
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1359
contents:something keepUndoHistory:keepUndoHistory
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1360
    super contents:something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1361
    keepUndoHistory ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1362
        undoSupport resetHistories.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1363
    ].
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
contentsAsString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1367
    "return the contents as a String (i.e. without emphasis)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1368
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1369
    list isNil ifTrue:[^ ''].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1370
    self removeTrailingBlankLines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1371
    ^ (list collect:[:each | each isNil ifTrue:['']
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1372
                                        ifFalse:[each string]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1373
                    ]) asStringWithCRs
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1376
cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1377
    "return the cursors col (1..).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1378
     This is the absolute col; NOT the visible col"
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
    ^ cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1381
!
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
cursorColHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1384
    "return a valueHolder for the cursors column (1..)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1385
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1386
    ^ cursorColHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1387
!
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
cursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1390
    "return the cursors line (1..).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1391
     This is the absolute line; NOT the visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1392
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1393
    ^ cursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1394
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1395
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1396
cursorLineHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1397
    "return a valueHolder for the cursors line (1..).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1398
     This is the absolute line; NOT the visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1399
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1400
    ^ cursorLineHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1401
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1402
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1403
lineStringBeforeCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1404
    "return the line's string before the cursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1405
     Pad with spaces up to the cursor position if beyond the end of line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1406
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1407
    |line|
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
    line := ((self at:cursorLine) ? '') string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1410
    line size < (cursorCol-1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1411
        ^ line paddedTo:(cursorCol-1)
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
    ^ line copyTo:(cursorCol-1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1414
!
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
list:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1417
    "position cursor home when setting contents"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1418
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1419
    |prevCursorLine prevCursorCol|
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
    prevCursorLine := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1422
    prevCursorCol := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1423
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1424
    super list:something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1425
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1426
    (cursorMovementWhenUpdating == #endOfText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1427
    or:[cursorMovementWhenUpdating == #end]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1428
        ^ self cursorToEndOfText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1429
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1430
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1431
    (cursorMovementWhenUpdating == #endOfLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1432
        ^ self cursorLine:prevCursorLine col:(self listAt:cursorLine) size + 1.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1435
    (cursorMovementWhenUpdating == #beginOfText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1436
    or:[cursorMovementWhenUpdating == #begin]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1437
        ^ self cursorHome
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
    (cursorMovementWhenUpdating == #beginOfLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1440
        ^ self cursorLine:prevCursorLine col:1.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1443
    "/ default: stay where it was
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1444
    "/ self cursorLine:prevCursorLine col:prevCursorCol.
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
setContents:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1448
    |selType|
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
    undoSupport resetHistories.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1451
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1452
    selType := typeOfSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1453
    super setContents:something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1454
    typeOfSelection := selType.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1455
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1456
    "Created: / 31.3.1998 / 23:35:06 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1457
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1458
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1459
!EditTextView methodsFor:'accessing-dimensions'!
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
absoluteXOfPosition:positionInText 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1462
    |accumulatedX container|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1463
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1464
    accumulatedX := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1465
    container := self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1466
    [ container notNil ] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1467
        accumulatedX := accumulatedX + container origin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1468
        container := container isTopView ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1469
                    container container
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1470
                ] ifTrue:[ nil ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1471
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1472
    ^ (self xOfPosition:positionInText) + accumulatedX
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1473
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1474
    "Created: / 16-02-2010 / 10:05:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1477
absoluteYOfCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1478
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1479
    | accumulatedY container |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1480
    accumulatedY := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1481
    container := self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1482
    [ container notNil ] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1483
        accumulatedY := accumulatedY + container origin y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1484
        container := container isTopView 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1485
            ifFalse:[container container]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1486
            ifTrue:[nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1487
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1488
    ^(self yOfCursor) + accumulatedY
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1489
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1490
    "Created: / 27-05-2005 / 07:45:53 / janfrog"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1491
    "Modified: / 27-05-2005 / 23:03:40 / janfrog"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1492
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1493
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1494
xOfCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1495
    |point|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1496
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1497
    cursorVisibleLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1498
        "/ take the end of the selection, if any
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1499
        (selectionStartLine notNil 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1500
            and:[ self listLineIsVisible:selectionEndLine ])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1501
        ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1502
            ^ self xOfCol:selectionEndCol inVisibleLine:selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1503
        ].
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
"/        point := device 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1506
"/                    translatePoint:(device pointerPosition)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1507
"/                    fromView:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1508
"/                    toView:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1509
"/        ((self bounds) containsPoint:point) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1510
"/            ^ point x
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
"/        ^ 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1513
        ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1514
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1515
    ^self xOfCol:cursorCol inVisibleLine:cursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1516
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1517
    "Created: / 27-05-2005 / 07:43:41 / janfrog"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1518
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1519
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1520
xOfPosition: positionInText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1521
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1522
    | line col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1523
    line := self lineOfCharacterPosition: positionInText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1524
    col  := positionInText - (self characterPositionOfLine:line col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1525
    ^
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1526
        (self xOfCol:col inVisibleLine:(self listLineToVisibleLine: line))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1527
            - viewOrigin x.
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
    "Created: / 16-02-2010 / 10:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1530
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1531
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1532
yOfCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1533
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1534
    ^self yOfVisibleLine:cursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1535
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1536
    "Created: / 27-05-2005 / 07:43:41 / janfrog"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1537
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1538
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1539
yOfPosition: positionInText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1540
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1541
    | line |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1542
    line := self lineOfCharacterPosition: positionInText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1543
    ^self yOfVisibleLine:(self listLineToVisibleLine: line)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1544
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1545
    "Created: / 16-02-2010 / 10:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1546
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1547
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1548
!EditTextView methodsFor:'accessing-look'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1549
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1550
cursorForegroundColor:color1 backgroundColor:color2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1551
    "set both cursor foreground and cursor background colors"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1552
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1553
    |wasOn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1554
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1555
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1556
    cursorFgColor := color1 onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1557
    cursorBgColor := color2 onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1558
    wasOn ifTrue:[self showCursor]
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1561
cursorType
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1562
    "return the style of the text cursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1563
     Currently, supported are: #none
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1564
                               #block, #frame, #ibeam, #caret, #solidCaret
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1565
                               #bigCaret and #bigSolidCaret"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1566
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1567
    ^ cursorType
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1568
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1569
    "Modified: / 5.5.1999 / 14:52:33 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1570
!
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
cursorType:aCursorTypeSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1573
    "set the style of the text cursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1574
     Currently, supported are: #none
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1575
                               #block, #frame, #ibeam, #caret, #solidCaret
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1576
                               #bigCaret and #bigSolidCaret"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1577
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1578
    cursorType := aCursorTypeSymbol.
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
    "Created: 21.9.1997 / 13:42:23 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1581
    "Modified: 21.9.1997 / 13:43:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1582
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1583
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1584
cursorTypeNoFocus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1585
    "return the style of the text cursor when the view has no focus.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1586
     If left unspecified, this is the same as the regular cursorType."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1587
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1588
    ^ cursorTypeNoFocus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1589
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1590
    "Created: / 5.5.1999 / 14:52:46 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1593
cursorTypeNoFocus:aCursorTypeSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1594
    "set the style of the text cursor when the view has no focus.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1595
     If left unspecified, this is the same as the regular cursorType."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1596
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1597
    cursorTypeNoFocus := aCursorTypeSymbol
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
!EditTextView methodsFor:'accessing-replace'!
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
lastReplacementInfo
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1603
    ^ lastReplacementInfo
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1604
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1605
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1606
lastStringToReplace: aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1607
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1608
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1609
previousReplacements
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1610
    "accessor for the code completion"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1611
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1612
    ^ lastReplacementInfo previousReplacements
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1613
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1614
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1615
!EditTextView methodsFor:'change & update'!
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
accept
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1618
    "accept the current contents by executing the accept-action and/or
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1619
     changeMessage."
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
    acceptEnabled == false ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1622
        self beep.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1623
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1624
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1625
    (disableIfInvisible == true and:[self reallyRealized not]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1626
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1627
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1628
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1629
    lockUpdates := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1630
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1631
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1632
    "/ ST-80 way of doing it
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
    model notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1635
        self sendChangeMessage:changeMsg with:self argForChangeMessage.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1636
        acceptChannel value:true withoutNotifying:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1637
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1638
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1639
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1640
    "/ ST/X way of doing things
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1641
    "/ as a historic (and temporary) leftover,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1642
    "/ the block is called with a stringCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1643
    "/ - not with the actual string
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
    acceptAction notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1646
        acceptAction value:self list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1647
    ].
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
    lockUpdates := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1650
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1651
    "Modified: / 30.1.1998 / 14:19:00 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1652
!
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
argForChangeMessage
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1655
    "return the argument to be passed with the change notification.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1656
     Defined as separate method for easier subclassability."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1657
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1658
    ^ self contents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1659
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1660
    "Modified: 29.4.1996 / 12:42:14 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1661
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1662
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1663
getListFromModel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1664
    "get my contents from the model.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1665
     Redefined to ignore updates resulting from my own changes
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1666
     (i.e. if lockUpdates is true)."
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
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1669
     ignore updates from my own change
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1670
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1671
    lockUpdates ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1672
        lockUpdates := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1673
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1674
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1675
    super getListFromModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1676
    undoSupport resetHistories.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1677
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1678
    "/ validate the cursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1679
    (cursorLine notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1680
     and:[ cursorLine > list size ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1681
        self cursorLine:list size + 1 col:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1682
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1683
!
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
update:something with:aParameter from:changedObject
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1686
    changedObject == acceptChannel ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1687
        acceptChannel value == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1688
            self accept.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1689
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1690
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1691
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1692
    super update:something with:aParameter from:changedObject
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1693
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1694
    "Created: / 30.1.1998 / 14:15:56 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1695
    "Modified: / 1.2.1998 / 13:15:55 / cg"
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
!EditTextView methodsFor:'cursor handling'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1699
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1700
basicCursorReturn
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1701
    "move cursor to start of next line; scroll if at end of visible text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1702
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1703
    |wasOn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1704
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1705
    self checkForExistingLine:(cursorLine + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1706
    cursorVisibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1707
        nFullLinesShown notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1708
            (cursorVisibleLine >= nFullLinesShown) ifTrue:[self scrollDown]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1709
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1710
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1711
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1712
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1713
    self setValidatedCursorLine:(cursorLine + 1) col:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1714
    self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1715
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1716
    "Modified: 22.5.1996 / 18:27:34 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1717
!
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
characterPositionOfCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1720
    ^ self characterPositionOfLine:cursorLine col:cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1721
!
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
cursorBacktab
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1724
    "move cursor to prev tabstop"
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
    self cursorCol:(self prevTabBefore:cursorCol).
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1729
cursorCol:newCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1730
    "move cursor to some column in the current line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1731
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1732
    |wasOn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1733
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1734
    (cursorCol == newCol) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1735
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1736
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1737
    self setValidatedCursorCol:newCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1738
    self makeCursorVisibleAndShowCursor:wasOn.
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
    "Modified: 22.5.1996 / 14:25:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1741
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1742
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1743
cursorDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1744
    "move cursor down; scroll if at end of visible text;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1745
     beep if at end of physical text."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1746
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1747
    |wasOn|
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
    self cursorDown:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1750
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1751
    "/ cursor beyond text ?
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1752
    cursorLine > list size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1753
        wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1754
        self setValidatedCursorLine:(list size + 1) col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1755
        self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1756
        self beep.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1757
    ].
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
    "Modified: / 10.6.1998 / 17:00:23 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1760
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1761
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1762
cursorDown:n
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1763
    "move cursor down by n lines; scroll if at end of visible text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1764
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1765
    |wasOn nv nL|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1766
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1767
    (nL := cursorLine) isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1768
        nL := firstLineShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1769
    ].
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
    self st80EditMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1772
        nL == list size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1773
            wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1774
            self setValidatedCursorLine:(list size) col:(self listAt:list size) size + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1775
            self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1776
            self beep.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1777
            ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1778
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1779
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1780
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1781
    cursorVisibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1782
        wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1783
        nv := cursorVisibleLine + n - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1784
        (nv >= nFullLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1785
            self scrollDown:(nv - nFullLinesShown + 1)
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
        self setValidatedCursorLine:(cursorLine + n) col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1788
        self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1789
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1790
        self setValidatedCursorLine:(nL + n) col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1791
        self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1792
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1793
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1794
    "Modified: / 10.6.1998 / 16:59:17 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1797
cursorHome
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1798
    "scroll to top AND move cursor to first line of text."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1799
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1800
    self cursorLine:1 col:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1801
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1802
"/    |wasOn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1803
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1804
"/    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1805
"/    self scrollToTop.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1806
"/    cursorLine := cursorVisibleLine := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1807
"/    cursorCol := self validateCursorCol:1 inLine:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1808
"/    self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1809
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1810
    "Modified: 22.5.1996 / 18:26:42 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1811
!
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
cursorLeft
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1814
    "move cursor to left"
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
    (cursorCol ~~ 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1817
        self cursorCol:(cursorCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1818
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1819
        cursorLine ~~ 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1820
            self st80EditMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1821
                self cursorUp.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1822
                self cursorToEndOfLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1823
           ]
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
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1826
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1827
    "Modified: / 23.1.1998 / 12:37:13 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1828
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1829
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1830
cursorLeft:n
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1831
    "move cursor to left"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1832
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1833
    n timesRepeat:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1834
        self cursorLeft
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
!
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
cursorLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1839
    "this positions onto physical - not visible - line"
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
    |wasOn newCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1842
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1843
    ((line == cursorLine) and:[col == cursorCol]) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1844
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1845
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1846
    self setValidatedCursorLine:line.
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
    (col < 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1849
        newCol := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1850
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1851
        newCol := col.
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
    self st80EditMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1854
        (cursorLine == list size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1855
        and:[cursorLine ~~ line]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1856
            newCol := (self listAt:(list size)) size + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1857
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1858
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1859
    self setValidatedCursorCol:newCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1860
    self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1861
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1862
    "Modified: / 20.6.1998 / 18:19:06 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1863
!
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
cursorMovementAllowed
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1866
    "return true, if the user may move the cursor around
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1867
     (via button-click, or cursor-key with selection).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1868
     By default, true is returned, but this may be redefined
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1869
     in special subclasses (such as a terminal view), where
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1870
     this is not wanted"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1871
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1872
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1873
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1874
    "Created: / 18.6.1998 / 14:11:16 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1877
cursorReturn
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1878
    "move cursor to start of next line; scroll if at end of visible text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1879
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1880
    self basicCursorReturn
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1883
cursorRight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1884
    "move cursor to right"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1885
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1886
    |l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1887
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1888
    self st80EditMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1889
        l := (self listAt:cursorLine).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1890
        cursorCol >= (l size + 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1891
            cursorLine < list size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1892
                self cursorReturn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1893
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1894
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1895
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1896
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1897
    self cursorCol:(cursorCol + 1)
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
    "Modified: / 20.6.1998 / 18:19:07 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1900
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1901
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1902
cursorRight:n
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1903
    "move cursor to right"
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
    n timesRepeat:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1906
        self cursorRight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1907
    ].
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
cursorShown:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1911
    "change cursor visibility
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1912
     return true if cursor was visible before."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1913
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1914
    |oldState|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1915
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1916
    aBoolean == cursorShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1917
        ^ cursorShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1918
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1919
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1920
    oldState := cursorShown.
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
    aBoolean ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1923
        self drawCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1924
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1925
        (cursorShown and:[shown]) ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1926
            self undrawCursor.
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
    cursorShown := aBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1930
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1931
    ^ oldState
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
    "Modified: / 30.3.1999 / 15:32:43 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1934
    "Created: / 30.3.1999 / 15:59:30 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1935
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1936
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1937
cursorTab
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1938
    "move cursor to next tabstop"
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
    self cursorCol:(self nextTabAfter:cursorCol).
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1943
cursorToBeginOfLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1944
    "move cursor to the start of the current line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1945
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1946
    |textStart l|
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
    l := self listAt:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1949
    textStart := l isNil ifTrue:[1] ifFalse:[l indexOfNonSeparator].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1950
    cursorCol > textStart ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1951
        self cursorCol:textStart
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1952
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1953
        self cursorCol:1
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1956
    "Created: / 8.8.2004 / 18:51:21 / janfrog"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1957
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1958
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1959
cursorToBeginOfSelection
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1960
    "Move cursor to the beginning of current selection. noop if 
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1961
     there's no selection."
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1962
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1963
    self hasSelection ifTrue:[
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1964
        self cursorLine: selectionStartLine col: selectionStartCol
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1965
    ]
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1966
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1967
    "Created: / 29-08-2013 / 23:16:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1968
!
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1969
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1970
cursorToBottom
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1971
    "move cursor to the last line of text (col 1)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1972
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1973
    |wasOn newTop|
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
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1976
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1977
    newTop := list size - nFullLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1978
    (newTop < 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1979
        newTop := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1980
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1981
    self scrollToLine:newTop.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1982
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1983
    self setValidatedCursorLine:(list size) col:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1984
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1985
    self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1986
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1987
    "Modified: 22.5.1996 / 18:27:45 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1988
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1989
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1990
cursorToCharacterPosition:pos
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1991
    "compute line/col from character position (1..)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1992
     and move the cursor onto that char"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1993
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1994
    |line col|
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
    line := self lineOfCharacterPosition:pos.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1997
    col := pos - (self characterPositionOfLine:line col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1998
    self cursorLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1999
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2000
    "Created: / 15.1.1998 / 21:55:33 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2001
!
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
cursorToEnd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2004
    "move cursor down below last line of text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2005
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2006
    |wasOn newTop lineNr line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2007
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2008
    lineNr := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2009
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2010
    cursorLine >= lineNr ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2011
        line := self listAt:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2012
        (line isEmptyOrNil) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2013
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2014
        ]
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
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2018
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2019
    lineNr := lineNr + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2020
    newTop :=  lineNr - nFullLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2021
    (newTop < 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2022
        newTop := 1
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
    self scrollToLine:newTop.
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
    self setValidatedCursorLine:lineNr col:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2027
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2028
    self makeCursorVisibleAndShowCursor:wasOn.
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
    "Modified: 22.5.1996 / 18:27:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2031
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2032
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2033
cursorToEndOfLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2034
    "move cursor to end of current line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2035
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2036
    |line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2037
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2038
    line := (self listAt:cursorLine).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2039
    self cursorCol:(line size + 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2040
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2041
    "Modified: 13.8.1997 / 15:34:02 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2042
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2043
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2044
cursorToEndOfSelection
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2045
    "Move cursor to the end of current selection. noop if 
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2046
     there's no selection."
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2047
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2048
    self hasSelection ifTrue:[
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2049
        self cursorLine: selectionEndLine col: selectionEndCol + 1
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2050
    ]
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2051
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2052
    "Created: / 29-08-2013 / 23:16:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2053
!
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  2054
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2055
cursorToEndOfText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2056
    "move cursor to the end of the text (behind the last character in last line)"
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
    |wasOn newTop lastLineLength pos|
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
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2061
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2062
    newTop := list size - nFullLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2063
    (newTop < 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2064
        newTop := 1
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
    self scrollToLine:newTop.
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
    self setValidatedCursorLine:list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2069
    lastLineLength := (self listAt:cursorLine) size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2070
    pos := (lastLineLength==0) ifTrue:[0] ifFalse:[lastLineLength+1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2071
    self setCursorCol:(self validateCursorCol:pos inLine:cursorLine).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2072
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2073
    self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2074
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2075
    "Modified: / 15-07-2011 / 20:14:43 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2078
cursorToEndOfWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2079
    "move the cursor to the end of the word"
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
    (cursorLine > list size) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2082
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2083
    self wordAtLine:cursorLine col:cursorCol do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2084
        :beginLine :beginCol :endLine :endCol :style |
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
        self cursorLine:endLine col:endCol+1
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2089
    "Created: / 28-06-2006 / 19:16:30 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2090
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2091
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2092
cursorToFirstVisibleLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2093
    "place cursor into the first visible line; do not scroll."
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
    self cursorLine:(self visibleLineToAbsoluteLine:1) col:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2096
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2097
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2098
cursorToLastVisibleLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2099
    "place cursor into the first visible line; do not scroll."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2100
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2101
    self cursorLine:(self visibleLineToAbsoluteLine:nFullLinesShown) col:1
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2104
cursorToNextWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2105
    "move the cursor to the beginning of the next word"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2106
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2107
    |col line searching|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2108
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2109
    (cursorLine > list size) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2110
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2111
    self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2112
        wordAtLine:cursorLine col:cursorCol 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2113
        do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2114
            :beginLine :beginCol :endLine :endCol :style |
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
            line := endLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2117
            col := endCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2118
            searching := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2119
            [searching and:[(self characterAtLine:line col:col) isSeparator]] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2120
                self wordAtLine:line col:col do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2121
                    :beginLine :beginCol :endLine :endCol :style |
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
                    (line > list size) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2124
                        "break out"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2125
                        searching := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2126
                    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2127
                        line := endLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2128
                        col := endCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2129
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2130
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2131
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2132
            self cursorLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2133
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2134
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2135
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2136
cursorToPreviousWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2137
    "move the cursor to the beginning of this or the previous word"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2138
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2139
    |col line searching l|
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
    (cursorLine > list size) ifTrue:[^ self].      "/ this is rubbish
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2142
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2143
    self wordAtLine:cursorLine col:cursorCol do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2144
        :beginLine :beginCol :endLine :endCol :style |
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
        line := beginLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2147
        col := beginCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2148
        style == #wordLeft ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2149
            col := col + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2150
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2151
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2152
        (cursorLine == line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2153
        and:[cursorCol == col]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2154
            searching := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2155
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2156
            col > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2157
                col := col - 1.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2160
            [searching] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2161
                (col == 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2162
                    line == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2163
                        searching := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2164
                    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2165
                        line := line - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2166
                        l := list at:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2167
                        col := l size + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2168
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2169
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2170
                    (self characterAtLine:line col:col) isSeparator ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2171
                        self wordAtLine:line col:col do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2172
                            :beginLine :beginCol :endLine :endCol :style |
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
                            line := beginLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2175
                            col := beginCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2176
                            style == #wordLeft ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2177
                                col := col + 1
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
                            searching := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2180
                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2181
                    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2182
                        col := col - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2183
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2184
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2185
            ]
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
        self cursorLine:line col:col
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2190
    "Created: 8.3.1996 / 21:52:48 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2191
    "Modified: 8.3.1996 / 22:12:45 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2194
cursorToTop
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2195
    "move cursor to absolute home"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2196
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2197
    self cursorLine:1 col:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2198
!
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
cursorUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2201
    "move cursor up; scroll if at start of visible text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2202
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2203
    self cursorUp:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2204
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2205
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2206
cursorUp:n
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2207
    "move cursor up n lines; scroll if at start of visible text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2208
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2209
    |wasOn nv nl|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2210
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2211
    cursorLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2212
        self setCursorLine:(firstLineShown + nFullLinesShown - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2213
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2214
    nl := cursorLine - n.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2215
    nl < 1 ifTrue:[nl := 1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2216
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2217
    (nl ~~ cursorLine) ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2218
        wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2219
        cursorVisibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2220
            nv := cursorVisibleLine - n.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2221
            nv < 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2222
                self scrollUp:(nv negated + 1)
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
        self setValidatedCursorLine:nl col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2226
"/        wasOn ifTrue:[self showCursor].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2227
        self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2228
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2229
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2230
    "Modified: 22.5.1996 / 18:28:11 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2231
!
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
cursorVisibleLine:visibleLineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2234
    "put cursor to visibleline/col"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2235
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2236
    |wasOn newCol listLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2237
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2238
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2239
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2240
    listLine := self visibleLineToAbsoluteLine:visibleLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2241
    self setValidatedCursorLine:listLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2242
    cursorVisibleLine := visibleLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2243
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2244
    newCol := colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2245
    (newCol < 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2246
        newCol := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2247
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2248
    self setValidatedCursorCol:newCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2249
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2250
    self makeCursorVisibleAndShowCursor:wasOn.
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
    "Modified: / 20.6.1998 / 18:40:28 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2253
!
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
cursorX:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2256
    "put cursor to position next to x/y coordinate in view"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2257
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2258
    |line col|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2259
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2260
    line := self visibleLineOfY:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2261
    col := self colOfX:x inVisibleLine:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2262
    self cursorVisibleLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2263
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2264
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2265
drawCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2266
    "draw the cursor if shown and cursor is visible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2267
     (but not, if there is a selection - to avoid confusion)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2268
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2269
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2270
        cursorVisibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2271
            self hasSelection ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2272
                self drawCursorCharacter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2273
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2274
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2275
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2276
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2277
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2278
drawCursor:cursorType with:fgColor and:bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2279
    "draw a cursor; the argument cursorType specifies what type
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2280
     of cursor should be drawn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2281
     Currently, supported are: #none, 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2282
                               #block, #frame, #ibeam, #caret, #solidCaret
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2283
                               #bigCaret and #bigSolidCaret"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2284
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2285
    |x y w char y2 x1 x2 oldPaint oldClip|
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
    self hasSelection ifTrue:[
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
         hide cursor, if there is a selection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2290
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2291
        ^ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2292
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2293
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2294
    cursorType == #none ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2295
        ^ self
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2298
    cursorType == #block ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2299
        super drawVisibleLine:cursorVisibleLine col:cursorCol with:fgColor and:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2300
        ^ self
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
    x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2303
    y := self yOfVisibleLine:cursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2304
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2305
    oldPaint := self paint. "/ do not clobber GC
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2306
    cursorType == #frame ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2307
        super redrawVisibleLine:cursorVisibleLine col:cursorCol.
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
        char := self characterUnderCursor asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2310
        self paint:bgColor.                       
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2311
        self displayRectangleX:x y:y width:(gc font widthOf:char) height:fontHeight-2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2312
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2313
        self paint:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2314
        cursorType == #ibeam ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2315
            x1 := x - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2316
            y2 := y + fontHeight - lineSpacing.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2317
            self displayLineFromX:x1 y:y toX:x1 y:y2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2318
            self displayLineFromX:x y:y toX:x y:y2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2319
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2320
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2321
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2322
        cursorType == #Ibeam ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2323
            x1 := x - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2324
            y := y + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2325
            y2 := y + fontHeight - lineSpacing.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2326
            self displayLineFromX:x1 y:y toX:x1 y:y2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2327
            self displayLineFromX:x y:y toX:x y:y2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2328
            self displayLineFromX:x1-2 y:y toX:x+2 y:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2329
            self displayLineFromX:x1-2 y:y2 toX:x+2 y:y2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2330
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2331
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2332
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2333
        y := y + fontHeight - 3.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2334
        ((cursorType == #bigCaret) or:[cursorType == #bigSolidCaret]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2335
            w := (fontWidth * 2 // 3) max:4.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2336
            y2 := y + w + (w//2).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2337
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2338
            w := (fontWidth // 2) max:4.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2339
            y2 := y + w.
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
        x1 := x - w.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2342
        x2 := x + w.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2343
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2344
        oldClip := self clippingRectangleOrNil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2345
        self clippingRectangle:(margin@margin extent:(width-margin) @ (height-margin)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2346
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2347
        cursorType == #caret ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2348
            self lineWidth:2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2349
            self displayLineFromX:x1 y:y2 toX:x y:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2350
            self displayLineFromX:x y:y toX:x2 y:y2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2351
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2352
            "anything else: solidCaret"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2353
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2354
            self fillPolygon:(Array with:(x1 @ y2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2355
                                    with:(x @ y)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2356
                                    with:(x2 @ y2))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2357
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2358
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2359
        self clippingRectangle:oldClip
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2360
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2361
    self paint:oldPaint.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2362
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2363
    "Modified: / 15.12.1999 / 22:24:17 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2366
drawCursorCharacter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2367
    "draw the cursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2368
     (i.e. the cursor if no selection)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2369
     - helper for many cursor methods"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2370
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2371
    (hasKeyboardFocus
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2372
     and:[self enabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2373
     and:[self isReadOnly not]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2374
        self drawFocusCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2375
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2376
        self drawNoFocusCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2377
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2378
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2379
    "Modified: / 23.3.1999 / 13:52:48 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2382
drawFocusCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2383
    "draw the cursor when the focus is in the view."
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 hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2386
        ^ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2387
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2388
    cursorType == #none ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2389
        ^ self undrawCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2390
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2391
    self drawCursor:cursorType with:cursorFgColor and:cursorBgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2392
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2393
    "Modified: 22.9.1997 / 00:16:38 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2394
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2395
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2396
drawNoFocusCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2397
    "draw the cursor for the case when the view has no keyboard focus"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2398
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2399
    |cType|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2400
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2401
    self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2402
        ^ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2403
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2404
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2405
    cType := cursorTypeNoFocus ? cursorType.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2406
    cType == #none ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2407
        ^ self undrawCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2408
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2409
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2410
    cType == #block ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2411
        ^ self drawCursor:#frame with:cursorNoFocusFgColor and:cursorBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2412
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2413
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2414
    ^ self drawCursor:cType with:cursorNoFocusFgColor and:cursorNoFocusFgColor.
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
    "Modified: 22.9.1997 / 00:16:13 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2419
gotoLine:aLineNumber
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2420
    "position cursor onto line, aLineNumber.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2421
     Make certain that this line is visible"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2422
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2423
    self makeLineVisible:aLineNumber.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2424
    self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2425
    self cursorLine:aLineNumber col:1
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2428
hideCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2429
    "make cursor invisible if currently invisible"
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
    ^ self cursorShown:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2432
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2433
    "Modified: / 30.3.1999 / 16:02:28 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2434
!
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
makeCursorVisible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2437
    "scroll text to make cursorline visible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2438
     (i.e. to have cursorLine in visible area)"
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
    |line col|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2441
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2442
    cursorLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2443
        line := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2444
        col := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2445
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2446
         if there is a selection, its better to
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2447
         have its start being visible, instead of the end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2448
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2449
        (selectionStartLine notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2450
        and:[selectionEndLine notNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2451
            expandingTop ~~ false ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2452
                line := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2453
                col := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2454
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2455
                line := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2456
                col := selectionEndCol
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
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2459
        self makeLineVisible:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2460
        self makeColVisible:col inLine:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2461
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2462
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2463
    "Modified: 6.3.1996 / 13:46:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2464
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2465
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2466
makeCursorVisibleAndShowCursor:flag
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2467
    "scroll to make cursorLine visible;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2468
     if flag is true, draw the cursor"
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
    self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2471
    flag ifTrue:[self showCursor]
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
setCursorCol:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2475
    "strictly private: set the cursorCol"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2476
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2477
    cursorCol := (colNr max:1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2478
    cursorColHolder value:cursorCol.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2481
setCursorLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2482
    "strictly private: set the cursorLine"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2483
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2484
    "/ self assert:(lineNr notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2485
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2486
    cursorLine := (lineNr ? 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2487
    cursorLineHolder value:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2488
    self updateCursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2489
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2490
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2491
setCursorLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2492
    "strictly private: set the cursorLine, col and update the visibleLine"
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
    self setCursorLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2495
    self setCursorCol:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2496
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2497
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2498
setValidatedCursorCol:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2499
    "strictly private: set the cursorCol"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2500
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2501
    self setCursorCol:(self validateCursorCol:colNr inLine:cursorLine).
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
setValidatedCursorLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2505
    "strictly private: set the cursorLine and update the visibleLine"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2506
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2507
    self setCursorLine:(self validateCursorLine:lineNr).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2508
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2509
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2510
setValidatedCursorLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2511
    "strictly private: set the cursorLine, col and update the visibleLine"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2512
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2513
    self setValidatedCursorLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2514
    self setValidatedCursorCol:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2515
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2516
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2517
showCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2518
    "make cursor visible if currently invisible"
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
    ^ self cursorShown:true
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
    "Modified: / 30.3.1999 / 16:02:34 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2523
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2524
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2525
undrawCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2526
    "undraw the cursor (i.e. redraw the character(s) under the cursor)"
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
    |prevCol line oldClip x y e1 e2 e3|
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
    cursorVisibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2531
        prevCol := cursorCol - 1.
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
        "/ if there is any italic stuff in the cursor line,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2534
        "/ redraw it completely (because characters overlap).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2535
        cursorCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2536
            (line := self listAt:cursorLine) notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2537
                line hasChangeOfEmphasis ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2538
                    line size >= (cursorCol-1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2539
                        e1 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol-1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2540
                        line size >= (cursorCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2541
                            e2 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2542
                            line size >= (cursorCol+1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2543
                                e3 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol+1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2544
                            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2545
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2546
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2547
                    (e1 notNil or:[e2 notNil or:[e3 notNil]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2548
                        ^ super redrawVisibleLine:cursorVisibleLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2549
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2550
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2551
            ]
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2554
        ((cursorType == #caret)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2555
         or:[cursorType == #solidCaret
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2556
         or:[cursorType == #bigSolidCaret
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2557
         or:[cursorType == #bigCaret
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2558
         or:[cursorType == #Ibeam]]]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2559
            "caret-cursor touches 4 characters"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2560
            ((cursorCol > 1) and:[fontIsFixedWidth]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2561
                super redrawVisibleLine:cursorVisibleLine-1 from:prevCol to:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2562
                super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2563
                super redrawVisibleLine:cursorVisibleLine+1 from:prevCol to:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2564
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2565
                "care for left margin"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2566
                super redrawVisibleLine:cursorVisibleLine; redrawVisibleLine:cursorVisibleLine+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2567
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2568
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2569
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2570
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2571
        cursorType == #ibeam ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2572
            "ibeam-cursor touches 2 characters"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2573
            cursorCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2574
                super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2575
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2576
                "care for left margin"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2577
                super redrawVisibleLine:cursorVisibleLine.
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
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2580
        ].
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
        "block cursor is simple - just one character under cursor"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2583
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2584
        "/ however, if italic characters are involved, we must care
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2585
        "/ for the chars before/after the cursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2586
        "/ We redraw the part of the previous character which got
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2587
        "/ detroyed by the block cursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2588
        "/ (must change the clip, to avoid destroying the prev-prev character)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2589
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2590
        line := self visibleAt:cursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2591
        (line notNil and:[line isText]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2592
            cursorCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2593
                oldClip := self clippingRectangleOrNil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2594
                x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2595
                y := self yOfVisibleLine:cursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2596
                self clippingRectangle:(x@y extent:((gc font width * 2) @ fontHeight)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2597
                super redrawVisibleLine:cursorVisibleLine from:cursorCol-1 to:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2598
                self clippingRectangle:oldClip.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2599
                ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2600
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2601
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2602
        super redrawVisibleLine:cursorVisibleLine col:cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2603
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2604
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2605
    "Modified: / 15.12.1999 / 22:25:59 / cg"
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
updateCursorVisibleLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2609
    "strictly private: set the visibleLine from the cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2610
     notice: visibleLine will be set to nil if the cursor is not visible"
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
    cursorVisibleLine := self listLineToVisibleLine:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2613
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2614
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2615
validateCursorCol:col inLine:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2616
    "check of col is a valid cursor position; return a new col-nr if not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2617
     Here, no limits are enforced (and col is returned),
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2618
     but it may be redefined in EditFields or views which dont like the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2619
     cursor to be positioned behind the end of a textLine (vi/st-80 behavior)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2620
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2621
    |l max|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2622
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2623
    "/ in ST80 mode,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2624
    "/ the cursor may not be positioned beyond the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2625
    "/ end of a line or beyond the last line of the text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2626
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2627
    self st80EditMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2628
        l := (self listAt:line).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2629
        max := l size + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2630
        col > max ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2631
            ^ max
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2632
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2633
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2634
    ^ col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2635
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2636
    "Created: / 22.5.1996 / 14:25:30 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2637
    "Modified: / 20.6.1998 / 18:19:24 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2638
!
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
validateCursorLine:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2641
    "check of line is a valid cursor line; return a fixed line-nr if not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2642
     Here, no limits are enforced (and line is returned), but it may be
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2643
     redefined in views which dont like the cursor to be positioned
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2644
     behind the end of the text (vi/st-80 behavior), or want to
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2645
     skip reserved regions"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2646
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
    "/ in st80Mode, the cursor may not be positioned
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2649
    "/ beyond the last line
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
    self st80EditMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2652
        ^ (line min:(list size)) max:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2653
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2654
    ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2655
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2656
    "Created: / 22.5.1996 / 18:22:23 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2657
    "Modified: / 20.6.1998 / 18:19:26 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2658
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2659
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2660
withCursorOffDo:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2661
    "evaluate aBlock with cursor off; turn it on afterwards."
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
    (shown not or:[cursorShown not]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2664
        ^ aBlock value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2665
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2666
    self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2667
    aBlock ensure:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2668
        self showCursor
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
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2671
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2672
!EditTextView methodsFor:'drag & drop'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2673
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2674
allowDrop:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2675
    "enable/disable drop support"
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
    aBoolean ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2678
        dropTarget := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2679
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2680
        dropTarget isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2681
            dropTarget := DropTarget 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2682
                                receiver:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2683
                                argument:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2684
                                dropSelector:#'drop:'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2685
                                canDropSelector:#'canDrop:'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2686
        ]
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
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2689
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2690
canDrop:aDropContext
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2691
    "public from d&d.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2692
     I accept textObjects and fileObjects only."
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
    "/ cg: disabled to avoid unintended drop (is same as copy-past, anyway)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2695
    aDropContext sourceWidget == self ifTrue:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2696
    ^ self canDropObjects:aDropContext dropObjects
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
    "Modified: / 13-10-2006 / 17:41:09 / cg"
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
canDropObjects:aCollectionOfDropObjects
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2702
    "public from d&d.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2703
     I accept textObjects and fileObjects only."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2704
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2705
    self checkModificationsAllowed ifFalse:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2706
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2707
    aCollectionOfDropObjects isEmpty ifTrue:[ ^ false ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2708
    ^ aCollectionOfDropObjects conform:[:obj| (obj isTextObject or:[obj isFileObject])]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2709
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2710
    "Created: / 13-10-2006 / 15:56:57 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2711
    "Modified: / 13-10-2006 / 17:41:14 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2712
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2713
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2714
drop:aDropContext
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2715
    "public from d&d.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2716
     drop objects (new API)"
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
    self dropObjects:(aDropContext dropObjects)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2719
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2720
    "Modified: / 13-10-2006 / 17:41:19 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2723
dropFileObject:aDropObject
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2724
    "drop objects
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2725
     For bw. compatibility, also collections of drop objects are handled (may vanish)"
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
    |answer text fn pasteWhat sensor dontAskAgainHolder enforcedDropMode app|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2728
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2729
    pasteWhat := #name.
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
    fn := aDropObject asFilename.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2732
    (fn exists and:[fn isRegularFile]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2733
        enforcedDropMode := UserPreferences current enforcedDropModeForFiles.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2734
        (enforcedDropMode notNil 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2735
        and:[enforcedDropMode ~~ #name or:[fn fileSize <= (1024*1024)]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2736
            pasteWhat := enforcedDropMode.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2737
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2738
            sensor := self sensor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2739
            (sensor shiftDown or:[sensor ctrlDown]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2740
                pasteWhat := #name.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2741
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2742
                (sensor metaDown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2743
                    pasteWhat := #contents.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2744
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2745
                    dontAskAgainHolder := false asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2746
                    answer := Dialog
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2747
                        confirmWithCancel:(resources
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2748
                                            stringWithCRs:'Drop the Filename (%1)\or its Contents ?\\Hint: bypass this dialog by pressing SHIFT/CTRL or ALT during the next drop.\SHIFT/CTRL to drop the name, ALT for the contents.'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2749
                                            with:fn name allBold)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2750
                        labels:#( 'Cancel' 'Name' 'Contents' )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2751
                        values:#( nil #name #contents )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2752
                        default:#contents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2753
                        check:(resources string:'Do not ask again; instead, always paste the contents of small files.') on:dontAskAgainHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2754
                        title:(resources string:'Drop What').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2755
                    answer isNil ifTrue:[ ^ self ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2756
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2757
                    dontAskAgainHolder value ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2758
                        UserPreferences current enforcedDropModeForFiles:#contents
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
                    pasteWhat := answer.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2761
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2762
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2763
        ].
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2766
    pasteWhat == #name ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2767
        text := fn pathName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2768
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2769
        self withWaitCursorDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2770
            text := fn contentsOfEntireFile
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2771
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2772
        (app := self application) notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2773
            app droppedFile:fn in:self
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
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2776
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2777
    self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2778
        undoablePaste:text 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2779
        info:'Drop File'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2780
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2781
    "Created: / 13-10-2006 / 17:38:31 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2782
    "Modified: / 28-07-2007 / 13:27:09 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2783
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2784
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2785
dropObject:aDropObject
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2786
    "drop objects
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2787
     For bw. compatibility, also collections of drop objects are handled (may vanish)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2788
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2789
    |text|
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
    (aDropObject isFileObject) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2792
        self dropFileObject:aDropObject
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2793
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2794
        aDropObject isTextObject ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2795
            text := aDropObject theObject.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2796
            text isStringCollection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2797
                text := text asStringWithoutFinalCR
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2798
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2799
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2800
            text := aDropObject theObject asString
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
        self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2803
            undoablePaste:text 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2804
            info:'Drop'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2805
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2806
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2807
    "Created: / 13-10-2006 / 17:37:05 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2808
    "Modified: / 28-07-2007 / 13:26:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2809
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2810
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2811
dropObjects:aCollectionOfDropObjects
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2812
    "public from d&d.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2813
     drop objects (old API)"
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
    aCollectionOfDropObjects do:[:el |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2816
        self dropObject:el
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2819
    "Created: / 13-10-2006 / 15:59:40 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2820
    "Modified: / 13-10-2006 / 17:41:23 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2821
! !
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
!EditTextView methodsFor:'editing'!
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
convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2826
    "toLower/toUppercaseFirst/toUpper selected text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2827
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2828
    |line1 line2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2829
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2830
    line1 := self selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2831
    line2 := self selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2832
    line1 isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2833
        line1 := self perform:#cursorLine ifNotUnderstood:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2834
        line1 notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2835
            line2 := line1
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
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2838
    line1 notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2839
        line1 to:line2 do:[:lineNr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2840
            |line col1 col2 isAllLower isLowerFirst isAllUpper isUpperFirst
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2841
             makeLowercase makeUppercase makeUppercaseFirst makeLowercaseFirst|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2842
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2843
            line := (self listAt:lineNr) copy.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2844
            line size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2845
                lineNr == line1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2846
                    col1 := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2847
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2848
                    col1 := 1.
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
                lineNr == line2 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2851
                    col2 := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2852
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2853
                    col2 := (self listAt:lineNr) size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2854
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2855
                isAllLower := isAllUpper := isUpperFirst := isLowerFirst := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2856
                col1 to:col2 do:[:col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2857
                    |ch|
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
                    ch := line at:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2860
                    ch isUppercase ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2861
                        isAllLower := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2862
                        col == col1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2863
                            isLowerFirst := false.
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
                    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2866
                        ch isLowercase ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2867
                            isAllUpper := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2868
                            col == col1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2869
                                isUpperFirst := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2870
                            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2871
                        ]
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2875
                makeLowercase := makeUppercase := makeUppercaseFirst := makeLowercaseFirst := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2876
                isLowerFirst ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2877
                    makeUppercaseFirst := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2878
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2879
                    "/ must remember where we come from - otherwise, we end up
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2880
                    "/ in upperFirst - lowerFirst cycle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2881
                    "/ think about a good place to store this state
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2882
                    false "(isUpperFirst and:[isAllUpper not])" ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2883
                        makeLowercaseFirst := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2884
                     ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2885
                        isAllUpper ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2886
                            makeLowercase := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2887
                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2888
                            makeUppercase := true.
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
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2891
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2892
                makeUppercaseFirst ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2893
                    line at:col1 put:(line at:col1) asUppercase.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2894
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2895
                    makeLowercaseFirst ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2896
                        line at:col1 put:(line at:col1) asLowercase.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2897
                    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2898
                        col1 to:col2 do:[:col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2899
                            |ch|
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
                            ch := line at:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2902
                            ch := makeLowercase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2903
                                    ifTrue:[ ch asLowercase ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2904
                                    ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2905
                                        makeUppercase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2906
                                            ifTrue:[ ch asUppercase ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2907
                                            ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2908
                                                col == col1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2909
                                                    ifTrue:[ ch asUppercase ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2910
                                                    ifFalse:[ ch asLowercase ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2911
                                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2912
                                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2913
                            line at:col put:ch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2914
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2915
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2916
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2917
                self withoutRedrawAt:lineNr put:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2918
                self invalidateLine:lineNr.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2923
    "Created: / 14-07-2011 / 11:40:26 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2924
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2925
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2926
copyAndDeleteSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2927
    "copy the selection into the pastBuffer and delete it"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2928
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2929
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2930
        self setClipboardText:(self selection).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2931
        self deleteSelection.
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
    "Created: 27.1.1996 / 16:23:28 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2935
!
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
deleteCharAtCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2938
    "delete single character under cursor; does not merge lines"
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
    |wasOn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2941
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2942
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2943
    self deleteCharAtLine:cursorLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2944
    wasOn ifTrue:[self showCursor]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2945
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2946
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2947
deleteCharAtLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2948
    "delete a single character at colNr in line lineNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2949
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2950
    self st80EditMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2951
        (self listAt:cursorLine) size + 1 = colNr ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2952
            | wasOn |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2953
            wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2954
            self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2955
                cursorReturn;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2956
                cursorCol:1;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2957
                deleteCharBeforeCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2958
            wasOn ifTrue:[ self showCursor].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2959
            ^ self.
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
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2962
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2963
    self deleteCharsAtLine:lineNr fromCol:colNr toCol:colNr
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2966
deleteCharBeforeCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2967
    "delete single character to the left of cursor and move cursor to left"
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
    |soCol wasOn lineNrAboveCursor ln originalLine prevTab|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2970
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2971
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2972
    (autoIndent and:[ (tabPositions includes:cursorCol)]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2973
        prevTab := (self prevTabBefore:cursorCol) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2974
        ln := originalLine := (list at:cursorLine ifAbsent:'') ? ''.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2975
        ln size < prevTab ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2976
            ln := ln , (String new:prevTab withAll:Character space).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2977
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2978
        (ln copyTo:prevTab) isBlank ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2979
            (ln copyFrom:prevTab+1) isBlank ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2980
                cursorCol > prevTab ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2981
                    self st80EditMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2982
                        "/ ensure that there is no conflict here: st80EditMode will
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2983
                        "/ not allow a cursor position beyond the end of line,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2984
                        "/ so avoid that cursorLine:col: will force us to the beginning of the line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2985
                        originalLine size < prevTab ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2986
                            self basicListAt:cursorLine put:ln
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2987
                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2988
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2989
                    self cursorLine:cursorLine col:prevTab.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2990
                    wasOn ifTrue:[ self showCursor ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2991
                    ^  self
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
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2994
                self deleteFromLine:cursorLine col:prevTab toLine:cursorLine col:cursorCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2995
                self cursorLine:cursorLine col:prevTab.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2996
                wasOn ifTrue:[ self showCursor ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2997
                ^  self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2998
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2999
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3000
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3001
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3002
"/        (autoIndent
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3003
"/    and:[cursorCol  ~~ 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3004
"/    and:[cursorLine <= (list size)]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3005
"/     ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3006
"/        soCol := (self leftIndentForLine:cursorLine) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3007
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3008
"/        (cursorCol == soCol and:[soCol > 1]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3009
"/            ln := list at:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3010
"/            (ln notNil and:[(ln indexOfNonSeparatorStartingAt:1) < soCol]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3011
"/                soCol := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3012
"/            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3013
"/        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3014
"/    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3015
        soCol := 1.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3018
    (cursorCol ~~ soCol and:[cursorCol ~~ 1]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3019
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3020
         somewhere in the middle of a line
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
        self cursorLeft.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3023
        self deleteCharAtLine:cursorLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3024
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3025
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3026
         at begin of line - merge with previous line;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3027
         except for the very first line.
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
        (cursorLine == 1) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3030
            lineNrAboveCursor := self validateCursorLine:(cursorLine - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3031
            lineNrAboveCursor < cursorLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3032
                (lineNrAboveCursor > 0 and:[lineNrAboveCursor > list size]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3033
                    "/ we are beyond the end of the text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3034
                    "/ move the cursor to the previous line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3035
                    self cursorLine:lineNrAboveCursor col:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3036
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3037
                    self mergeLine:lineNrAboveCursor removeBlanks:false.
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
        ]
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
    wasOn ifTrue:[ self showCursor ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3043
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3044
    "Modified: / 16.1.1998 / 22:33:04 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3045
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3046
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3047
deleteCharsAtLine:lineNr fromCol:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3048
    "delete characters from colNr up to the end in line lineNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3049
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3050
    |line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3051
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3052
    (line := self listAt:lineNr) notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3053
        self deleteCharsAtLine:lineNr fromCol:colNr toCol:(line size)
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3058
deleteCharsAtLine:lineNr fromCol:startCol toCol:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3059
    "delete characters from startCol to endCol in line lineNr"
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
    |deleted|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3062
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3063
    deleted := self textFromLine:lineNr col:startCol toLine:lineNr col:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3064
    self basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3065
    self addUndo:(PasteString line:lineNr col:startCol string:deleted info:'delete').
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3068
deleteCharsAtLine:lineNr toCol:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3069
    "delete characters from start up to colNr in line lineNr"
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
    self deleteCharsAtLine:lineNr fromCol:1 toCol:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3072
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3073
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3074
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3075
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3076
deleteCursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3077
    "delete the line where the cursor sits"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3078
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3079
    self deleteLine:cursorLine
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3082
deleteFromCharacterPosition:charPos1 to:charPos2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3083
    "delete a substring at a character position"
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
    |line1 col1 line2 col2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3086
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3087
    line1 := self lineOfCharacterPosition:charPos1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3088
    col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3089
    col1 == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3090
        line1 := line1 - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3091
        col1 := (self listAt:line1) size + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3092
    ].
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
    line2 := self lineOfCharacterPosition:charPos2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3095
    col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3096
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3097
    self deleteFromLine:line1 col:col1 toLine:line2 col:col2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3098
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3099
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3100
deleteFromLine:startLine col:startCol toLine:endLine col:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3101
    "delete all text from startLine/startCol to endLine/endCol -
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3102
     joining lines if nescessary"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3103
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3104
    |line newLine lineSize nMore|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3105
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3106
    self checkModificationsAllowed ifFalse:[ ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3107
    list isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3108
    startLine > list size ifTrue:[ ^ self]. "/ deleted space below text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3109
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3110
    (startLine == endLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3111
        "/ delete chars within a line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3112
        self deleteCharsAtLine:startLine fromCol:startCol toCol:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3113
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3114
    ].
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
    ((startCol == 1) and:[endCol == 0]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3117
        "/ delete full lines only
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3118
        endLine > startLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3119
            self deleteFromLine:startLine toLine:(endLine - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3120
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3121
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3122
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3123
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3124
    "/ delete right rest of 1st line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3125
    self deleteCharsAtLine:startLine fromCol:(startCol max:1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3126
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3127
    "/ delete the inner lines ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3128
    endLine > (startLine + 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3129
        self deleteFromLine:(startLine + 1) toLine:(endLine - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3130
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3131
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3132
    (endCol ~~ 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3133
        "/ delete the left rest of the last line
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
        self deleteCharsAtLine:(startLine + 1) toCol:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3136
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3137
        "/ must add blanks, if startCol lies beyond end of startLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3138
        startLine <= list size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3139
            line := list at:startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3140
            lineSize := line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3141
            (startCol > lineSize) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3142
                newLine := line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3143
                line isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3144
                    newLine := String new:(startCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3145
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3146
                    nMore := startCol - 1 - lineSize.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3147
                    nMore > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3148
                        newLine := line , (line species new:nMore)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3149
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3150
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3151
                newLine ~~ line ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3152
                    self basicListAt:startLine put:newLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3153
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3154
                "/ TODO: remember old maxwidth of linerange,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3155
                "/ only clear widthOfWidestLine, if this max
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3156
                "/ length was (one of) the longest.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3157
                "/ avoids slow delete with huge texts.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3158
                widthOfWidestLine := nil. "/ i.e. unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3159
                self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3160
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3161
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3162
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3163
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3164
    "/ merge the left rest of 1st line with right rest of last line into one
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3165
    self mergeLine:startLine removeBlanks:false
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
    "Modified: / 10-11-1998 / 23:52:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3168
    "Modified: / 18-03-2011 / 18:25:01 / az"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3169
!
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
deleteFromLine:startLineNr toLine:endLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3172
    "delete some lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3173
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3174
    |deleted|
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
    deleted := self textFromLine:startLineNr col:1 toLine:endLineNr+1 col:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3177
    self basicDeleteFromLine:startLineNr toLine:endLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3178
    self addUndo:(PasteString line:startLineNr col:1 string:deleted info:'delete').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3179
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3180
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3181
deleteLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3182
    "delete line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3183
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3184
    self deleteFromLine:lineNr toLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3185
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3186
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3187
!
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
deleteLineWithoutRedraw:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3190
    "delete line - no redraw;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3191
     return true, if something was really deleted"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3192
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3193
    |deleted ret|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3194
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3195
    deleted := self textFromLine:lineNr col:1 toLine:lineNr+1 col:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3196
    ret := self basicDeleteLineWithoutRedraw:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3197
    self addUndo:(PasteString line:lineNr col:1 string:deleted info:'delete').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3198
    ^ ret.
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
deleteLinesWithoutRedrawFrom:startLine to:endLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3202
    "delete lines - no redraw;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3203
     return true, if something was really deleted"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3204
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3205
    |lastLine|
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
    self checkModificationsAllowed ifFalse:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3208
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3209
    (list isNil or:[startLine > list size]) ifTrue:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3210
    (endLine > list size) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3211
        lastLine := list size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3212
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3213
        lastLine := endLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3214
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3215
    self basicListRemoveFromIndex:startLine toIndex:lastLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3216
    "/ TODO: remember old maxwidth of linerange,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3217
    "/ only clear widthOfWidestLine, if this max
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3218
    "/ length was (one of) the longest.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3219
    "/ avoids slow delete with huge texts.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3220
    widthOfWidestLine := nil. "/ i.e. unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3221
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3222
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3223
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3224
    "Modified: / 10.11.1998 / 23:55:29 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3225
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3226
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3227
deleteSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3228
    "delete the selection"
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
    |wasOn startLine startCol endLine endCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3231
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3232
    self checkModificationsAllowed ifFalse:[ ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3233
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3234
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3235
        wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3236
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3237
        startLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3238
        startCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3239
        endLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3240
        endCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3241
        self unselectWithoutRedraw.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3242
        self deleteFromLine:startLine col:startCol toLine:endLine col:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3243
        self setCursorLine:startLine col:startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3244
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3245
        self makeCursorVisibleAndShowCursor:wasOn
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
deleteWordBeforeCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3250
    "delete the word to the left of cursor and move cursor to left"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3251
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3252
    |wasOn beginCol beginLine endCol endLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3253
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3254
    self checkModificationsAllowed ifFalse:[ ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3255
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3256
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3257
    self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3258
        undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3259
            endCol := cursorCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3260
            endLine := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3261
            self cursorToPreviousWord.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3262
            beginCol := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3263
            beginLine := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3264
            self deleteFromLine:beginLine col:beginCol toLine:endLine col:endCol.
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
        info:'Delete Word'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3267
    wasOn ifTrue:[ self showCursor ].
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
    "Modified: / 22.2.2000 / 23:59:04 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3270
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3271
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3272
insert:aCharacter atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3273
    "insert a single character at lineNr/colNr;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3274
     set emphasis to character at current position"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3275
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3276
    self basicInsert:aCharacter atLine:lineNr col:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3277
    aCharacter ~~ Character cr ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3278
        self addUndo:(DeleteCharacters line:lineNr col:colNr info:'insert').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3279
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3280
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3281
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3282
insertCharAtCursor:aCharacter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3283
    "insert a single character at cursor-position - advance cursor."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3284
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3285
    |wasOn|
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
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3288
    aCharacter == Character tab ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3289
        "/ needs special care to advance cursor correctly
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3290
        self insertTabAtCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3291
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3292
        self insert:aCharacter atLine:cursorLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3293
        aCharacter == (Character cr) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3294
            self basicCursorReturn
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3295
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3296
            self cursorRight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3297
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3298
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3299
    self makeCursorVisibleAndShowCursor:wasOn.
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
    "Modified: / 12.6.1998 / 21:50:20 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3302
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3303
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3304
insertLine:aString before:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3305
    "insert the line aString before line lineNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3306
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3307
    ^ self insertLines:(Array with:aString) from:1 to:1  before:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3308
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3309
    "Modified: 14.5.1996 / 13:42:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3310
!
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
insertLines:aStringCollection before:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3313
    "insert a bunch before line lineNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3314
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3315
    self insertLines:aStringCollection from:1 to:aStringCollection size before:lineNr
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
    "Modified: 6.9.1995 / 20:51:03 / claus"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3318
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3319
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3320
insertLines:someText from:start to:end before:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3321
    "insert a bunch of lines before line lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3322
     The cursor position is left unchanged."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3323
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3324
    |text indent visLine w nLines "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3325
     srcY "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3326
     dstY "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3327
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3328
    autoIndent ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3329
        indent := self leftIndentForLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3330
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3331
        text := someText 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3332
            collect:[:ln||line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3333
                ln notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3334
                    line := ln withoutLeadingSeparators.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3335
                    (line isEmpty or:[indent == 0]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3336
                        line := (String new:indent), line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3337
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3338
                    line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3339
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3340
                    nil
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
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3344
        text := someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3345
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3346
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3347
    visLine := self listLineToVisibleLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3348
    (shown not or:[visLine isNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3349
        self withoutRedrawInsertLines:text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3350
             from:start to:end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3351
             before:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3352
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3353
        nLines := end - start + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3354
        ((visLine + nLines) >= nLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3355
            self withoutRedrawInsertLines:text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3356
                 from:start to:end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3357
                 before:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3358
            self redrawFromVisibleLine:visLine to:nLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3359
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3360
            w := self widthForScrollBetween:(lineNr + nLines)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3361
                                        and:(firstLineShown + nLines + nLinesShown).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3362
            srcY := topMargin + ((visLine - 1) * fontHeight).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3363
            dstY := srcY + (nLines * fontHeight).
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
            "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3366
            "/ scroll ...
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
            "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3369
             stupid: must catchExpose before inserting new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3370
             stuff - since catchExpose may perform redraws
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3371
            "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3372
            self catchExpose.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3373
            self withoutRedrawInsertLines:text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3374
                 from:start to:end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3375
                 before:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3376
            self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3377
                copyFrom:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3378
                x:textStartLeft y:srcY
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3379
                toX:textStartLeft y:dstY
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3380
                width:w
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3381
                height:(height - dstY)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3382
                async:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3383
            self redrawFromVisibleLine:visLine to:(visLine + nLines - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3384
            self waitForExpose
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
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3387
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3388
        text do:[:line |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3389
            widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3390
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3391
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3392
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3393
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3394
    "Modified: 29.1.1997 / 13:02:39 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3397
insertLines:lines withCR:withCr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3398
    "insert a bunch of lines at cursor position.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3399
     Cursor is moved behind insertion.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3400
     If withCr is true, append cr after last line"
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
    |start end nLines wasOn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3403
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3404
    lines notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3405
        nLines := lines size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3406
        (nLines == 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3407
            self insertStringAtCursor:(lines at:1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3408
            withCr ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3409
                self insertCharAtCursor:(Character cr)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3410
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3411
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3412
            (cursorCol ~~ 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3413
                self insertStringAtCursor:(lines at:1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3414
                self insertCharAtCursor:(Character cr).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3415
                start := 2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3416
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3417
                start := 1
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
            withCr ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3420
                end := nLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3421
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3422
                end := nLines - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3423
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3424
            (start <= nLines) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3425
                (end >= start) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3426
                    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3427
                    self insertLines:lines from:start to:end before:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3428
                    self setCursorLine:(cursorLine + (end - start + 1)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3429
                    wasOn ifTrue:[self showCursor].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3430
                ]
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
            withCr ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3433
                "last line without cr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3434
                self insertStringAtCursor:(lines at:nLines)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3435
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3436
        ]
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3439
    "Created: / 18.5.1996 / 15:32:06 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3440
    "Modified: / 12.6.1998 / 21:51:16 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3441
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3442
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3443
insertLines:lines withCr:withCr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3444
    "insert a bunch of lines at cursor position. Cursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3445
     is moved behind insertion.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3446
     If withCr is true, append cr after last line"
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
    <resource:#obsolete>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3449
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3450
    self obsoleteMethodWarning:'use #insertLines:withCR:'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3451
    self insertLines:lines withCR:withCr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3452
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3453
    "Modified: 31.7.1997 / 23:07:22 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3454
!
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
insertSelectedStringAtCursor:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3457
    "insert the argument, aString at cursor position and select it"
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
    |startLine startCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3460
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3461
    startLine := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3462
    startCol := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3463
    self insertStringAtCursor:aString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3464
    self selectFromLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3465
                 toLine:cursorLine col:(cursorCol - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3466
    self makeSelectionVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3467
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3468
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3469
insertString:aString atCharacterPosition:charPos
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3470
    "insert the argument, aString at a character position"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3471
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3472
    |line col|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3473
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3474
    line := self lineOfCharacterPosition:charPos.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3475
    col := charPos - (self characterPositionOfLine:line col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3476
    self insertString:aString atLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3477
!
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
insertString:aString atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3480
    "insert the string, aString at line/col;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3481
     handle cr's correctly"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3482
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3483
    |start           "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3484
     stop            "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3485
     end             "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3486
     subString c
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3487
     l               "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3488
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3489
    aString isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3490
    (aString includes:(Character cr)) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3491
        ^ self insertStringWithoutCRs:aString atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3492
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3493
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3494
    l := lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3495
    c := colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3496
    start := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3497
    end := aString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3498
    [start <= end] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3499
        stop := aString indexOf:(Character cr) startingAt:start.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3500
        stop == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3501
            stop := end + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3502
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3503
        subString := aString copyFrom:start to:(stop - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3504
        self insertStringWithoutCRs:subString atLine:l col:c.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3505
        (stop <= end) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3506
            c := c + subString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3507
            self insert:(Character cr) atLine:l col:c.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3508
            l := l + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3509
            c := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3510
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3511
        start := stop + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3512
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3513
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3514
    "Modified: / 10.6.1998 / 19:03:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3515
!
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
insertStringAtCursor:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3518
    "insert the argument, aString at cursor position
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3519
     handle cr's correctly. A nil argument is interpreted as an empty line."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3520
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3521
    aString isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3522
        "new:"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3523
        self insertCharAtCursor:(Character cr).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3524
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3525
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3526
    (aString includes:(Character cr)) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3527
        ^ self insertStringWithoutCRsAtCursor:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3528
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3529
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3530
    self insertLines:aString asStringCollection withCR:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3531
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3532
    "Modified: / 10.6.1998 / 19:03:21 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3533
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3534
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3535
insertStringWithoutCRs:aString atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3536
    "insert aString (which has no crs) at lineNr/colNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3537
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3538
    self withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3539
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3540
        gc font hasOverlappingCharacters ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3541
            self invalidateLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3542
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3543
            self redrawLine:lineNr from:colNr
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
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3546
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3547
    "Modified: / 09-11-2010 / 13:43:03 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3548
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3549
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3550
insertStringWithoutCRsAtCursor:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3551
    "insert a string (which has no crs) at cursor position
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3552
     - advance cursor"
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
    |wasOn oldLen newLen deltaLen|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3555
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3556
    aString size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3557
        wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3558
        (aString includes:Character tab) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3559
            self checkForExistingLine:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3560
            oldLen := (list at:cursorLine) size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3561
            self insertString:aString atLine:cursorLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3562
            newLen := (list at:cursorLine) size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3563
            deltaLen := newLen - oldLen.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3564
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3565
            self insertString:aString atLine:(cursorLine ? 1) col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3566
            deltaLen := aString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3567
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3568
        self setCursorCol:(cursorCol + deltaLen).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3569
        wasOn ifTrue:[self showCursor]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3570
    ]
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
    "Modified: / 10.6.1998 / 20:43:52 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3575
insertTabAtCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3576
    "insert spaces to next tab"
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
    |wasOn nextTab|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3579
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3580
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3581
    nextTab := self nextTabAfter:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3582
    self insertStringAtCursor:(String new:(nextTab - cursorCol)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3583
    self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3584
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3585
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3586
joinLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3587
    "join lines (remove line-break)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3588
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3589
    self checkModificationsAllowed ifFalse:[ ^ self].
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
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3592
        undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3593
            |line col lineLen|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3594
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3595
            line := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3596
            col := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3597
            lineLen := (list at:line) size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3598
            col > lineLen ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3599
                self insertString:(String new:col-lineLen) atLine:line col:col+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3600
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3601
                self deleteCharsAtLine:line fromCol:col toCol:lineLen.
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
            self mergeLine:line removeBlanks:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3604
            self cursorLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3605
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3606
        info:'Join'
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
mergeLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3610
    "merge line lineNr with line lineNr+1"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3611
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3612
    self mergeLine:lineNr removeBlanks:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3613
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3614
    "Modified: 9.9.1997 / 09:28:03 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3615
!
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
mergeLine:lineNr removeBlanks:removeBlanks
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3618
    "merge line lineNr with line lineNr+1"
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
    |len|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3621
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3622
    self checkModificationsAllowed ifFalse:[ ^ self].
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
    len := (self listAt:lineNr) size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3625
    self nonUndoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3626
        self basicMergeLine:lineNr removeBlanks:removeBlanks.
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
    self addUndo:(PasteString new line:lineNr col:len+1 string:(Character cr asString) selected:false).
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
parenthizeSelectionWith:openingCharacter and:closingCharacter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3632
    |newSelectionEnd|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3633
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3634
    self hasSelection ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3635
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3636
    newSelectionEnd := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3637
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3638
    (self characterAtLine:selectionStartLine col:selectionStartCol) == openingCharacter ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3639
        (self characterAtLine:selectionEndLine col:selectionEndCol) == closingCharacter ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3640
            self deleteCharAtLine:selectionEndLine col:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3641
            newSelectionEnd := newSelectionEnd-1.
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
        self deleteCharAtLine:selectionStartLine col:selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3644
        selectionStartLine == selectionEndLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3645
            newSelectionEnd := newSelectionEnd-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3646
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3647
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3648
        self insert:closingCharacter atLine:selectionEndLine col:selectionEndCol+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3649
        newSelectionEnd := newSelectionEnd+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3650
        self insert:openingCharacter atLine:selectionStartLine col:selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3651
        selectionStartLine == selectionEndLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3652
            newSelectionEnd := newSelectionEnd+1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3653
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3654
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3655
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3656
        selectFromLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3657
        toLine:selectionEndLine col:newSelectionEnd.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3658
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3659
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3660
removeTrailingBlankLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3661
    "remove all blank lines at end of text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3662
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3663
    |lastLine "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3664
     line finished|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3665
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3666
    lastLine := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3667
    finished := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3668
    [finished] whileFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3669
        (lastLine <= 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3670
            finished := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3671
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3672
            line := list at:lastLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3673
            line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3674
                line isBlank ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3675
                    self basicListAt:lastLine put:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3676
                    line := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3677
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3678
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3679
            line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3680
                finished := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3681
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3682
                lastLine := lastLine - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3683
            ]
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
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3686
    (lastLine ~~ list size) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3687
        list grow:lastLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3688
"/        self textChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3689
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3690
!
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
replace:aCharacter atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3693
    "replace a single character at lineNr/colNr"
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
    |originalChar|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3696
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3697
    originalChar := self characterAtLine:lineNr col:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3698
    self basicReplace:aCharacter atLine:lineNr col:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3699
    self addUndo:(ReplaceCharacters line:lineNr col:colNr character:originalChar info:'replace').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3700
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3701
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3702
replace:patternArg by:replacePatternArg all:all ignoreCase:ignoreCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3703
    |pattern replacePattern|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3704
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3705
    pattern := patternArg string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3706
    replacePattern := replacePatternArg string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3707
    (pattern notEmpty and:[ replacePattern notEmpty ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3708
        self rememberSearchPattern:pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3709
        self rememberSearchPattern:replacePattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3710
        LastSearchIgnoredCase := ignoreCase.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3711
        self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3712
            undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3713
                all ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3714
                    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3715
                        replaceString:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3716
                        to:replacePattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3717
                        ignoreCase:ignoreCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3718
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3719
                    (self selectionAsString notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3720
                        and:[ self selectionAsString sameAs:pattern caseSensitive:ignoreCase not ])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3721
                            ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3722
                                self replaceSelectionBy:replacePattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3723
                                self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3724
                                    search:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3725
                                    ignoreCase:ignoreCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3726
                                    forward:(lastSearchDirection = #forward).
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
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3729
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3730
            info:'Replace'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3731
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3732
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3733
    "Created: / 11-07-2006 / 11:19:57 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3734
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3735
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3736
replaceCharAtCursor:aCharacter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3737
    "replace a single character at cursor-position - advance cursor"
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
    |wasOn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3740
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3741
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3742
    aCharacter == (Character cr) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3743
        self cursorReturn
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3744
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3745
        self replace:aCharacter atLine:cursorLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3746
        self cursorRight.
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
    self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3749
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3750
    "Created: 6.3.1996 / 12:27:42 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3751
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3752
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3753
replaceContentsWith:newContents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3754
    "replace everything"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3755
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3756
    |originalContents|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3757
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3758
    originalContents := self contents.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3759
    self contents:newContents keepUndoHistory:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3760
    self addUndo:(ReplaceContents text:originalContents info:'replace').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3761
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3762
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3763
replaceFromCharacterPosition:charPos1 to:charPos2 with:newString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3764
    "replace a substring at a character position"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3765
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3766
    "/ sigh - insert first, to avoid troible due to shifing-in virtual line ends
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3767
    self insertString:newString atCharacterPosition:charPos1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3768
    self deleteFromCharacterPosition:charPos1+newString size to:charPos2+newString size.
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
replaceLine:lineNr with:newText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3772
    "replace a line at lineNr"
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
    |originalLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3775
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3776
    originalLine := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3777
    originalLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3778
        self checkForExistingLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3779
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3780
    self list at:lineNr put:newText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3781
    self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3782
    self invalidateLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3783
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3784
    "Modified: / 12-04-2007 / 09:31:33 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3785
!
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
replaceLines:lines withCR:withCr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3788
    "replace a bunch of lines at cursor position. Cursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3789
     is moved behind replacement.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3790
     If withCr is true, move to the beginning of the next line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3791
     after the last line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3792
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3793
    |line col nLines wasOn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3794
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3795
    lines notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3796
        wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3797
        nLines := lines size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3798
        line := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3799
        col := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3800
        lines keysAndValuesDo:[:i :l |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3801
            self replaceString:(l ? '') atLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3802
            (i ~~ nLines or:[withCr]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3803
                line := line + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3804
                col := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3805
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3806
                col := col + (l size).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3807
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3808
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3809
        self cursorLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3810
        self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3811
        "/ wasOn ifTrue:[self showCursor].
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
    "Created: / 18-05-1996 / 15:32:06 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3815
    "Modified: / 25-07-2013 / 17:00:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3816
!
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
replaceSelectionBy:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3819
    "delete the selection (if any) and insert something, a character or string;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3820
     leave cursor after insertion"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3821
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3822
    self replaceSelectionBy:something keepCursor:false select:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3823
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3824
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3825
replaceSelectionBy:something keepCursor:keep
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3826
    "delete the selection (if any) and insert something, a character or string;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3827
     leave cursor after insertion or leave it, depending on keep"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3828
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3829
    self replaceSelectionBy:something keepCursor:keep select:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3830
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3831
    "Modified: 9.10.1996 / 16:14:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3832
!
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
replaceSelectionBy:something keepCursor:keep select:selectNewText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3835
    "delete the selection (if any) and insert something, a character or string;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3836
     leave cursor after insertion or leave it, depending on keep.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3837
     If selectNewText is true, select the new text; otherwise deselect"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3838
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3839
    |sel l c selStartLine selStartCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3840
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3841
    l := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3842
    c := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3843
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3844
    sel := self selectionAsString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3845
    sel isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3846
        selStartLine := l.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3847
        selStartCol := c.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3848
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3849
        selStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3850
        selStartCol := selectionStartCol.
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
        self setLastStringToReplace: sel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3853
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3854
        self deleteSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3855
        replacing := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3856
        lastReplacementInfo rememberReplacement.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3857
        lastReplacementInfo lastReplacement: ''.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3858
        lastReplacementInfo stillCollectingInput:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3859
        undoSupport actionInfo:'replace'.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3862
    something isCharacter ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3863
        lastReplacementInfo lastReplacement notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3864
            lastReplacementInfo stillCollectingInput ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3865
                lastReplacementInfo lastReplacement: (lastReplacementInfo lastReplacement copyWith:something).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3866
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3867
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3868
        self isInInsertMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3869
            self insertCharAtCursor:something
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
            self replaceCharAtCursor:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3872
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3873
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3874
        something isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3875
            lastReplacementInfo lastReplacement: something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3876
            self isInInsertMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3877
                self insertStringAtCursor:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3878
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3879
                self replaceStringAtCursor:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3880
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3881
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3882
            Transcript showCR:'EditTextView: non String-or-Character in replace'.
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
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3885
    keep ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3886
        self cursorLine:l col:c
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3887
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3888
    selectNewText ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3889
        self selectFromLine:selStartLine col:selStartCol toLine:cursorLine col:cursorCol-1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3890
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3891
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3892
    "Modified: 9.10.1996 / 16:14:35 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3895
replaceString:aString atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3896
    "replace multiple characters starting at lineNr/colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3897
     This is not prepared to encounter special chars (except TAB) in the string."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3898
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3899
    |originalString|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3900
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3901
    self checkModificationsAllowed ifFalse:[ ^ self].
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
    originalString := self textFromLine:lineNr col:colNr toLine:lineNr col:colNr+aString size-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3904
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3905
    self basicReplaceString:aString atLine:lineNr col:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3906
    self addUndo:(ReplaceCharacters line:lineNr col:colNr characters:originalString info:'replace').
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
replaceString:aString to:aNewString ignoreCase:ignoreCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3910
    |continue count|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3911
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3912
    self cursorToTop.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3913
    self selectFromBeginning.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3914
    count := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3915
    continue := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3916
    [ continue ] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3917
        (self selectionAsString notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3918
        and:[ self selectionAsString sameAs:aString caseSensitive:ignoreCase not ])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3919
            ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3920
                self replaceSelectionBy:aNewString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3921
                count := count + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3922
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3923
        self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3924
            searchFwd:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3925
            ignoreCase:ignoreCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3926
            ifAbsent:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3927
                Dialog information:('%1 has been replaced by %2 %3 times' 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3928
                                    bindWith:aString with:aNewString with:count).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3929
                continue := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3930
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3931
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3932
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3933
    "Created: / 10-07-2006 / 16:42:48 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3934
!
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
replaceStringAtCursor:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3937
    "replace multiple characters at cursor-position - advance cursor"
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
    |wasOn i1 i2|
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
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3942
    (aString includes:Character tab) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3943
        "/ need special care for TAB (to move cursor correctly)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3944
        i1 := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3945
        [i1 ~~ 0] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3946
            i2 := aString indexOf:Character tab startingAt:i1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3947
            i2 ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3948
                i1 ~~ i2 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3949
                    self replaceString:(aString copyFrom:i1 to:i2-1) atLine:cursorLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3950
                    self cursorCol:(cursorCol + (i2 - i1)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3951
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3952
                self replaceTABAtCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3953
                i2 := i2 + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3954
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3955
                self replaceString:(aString copyFrom:i1) atLine:cursorLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3956
                self cursorCol:(cursorCol + (aString size - i1 + 1)).
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
            i1 := i2.
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
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3961
        self replaceString:aString atLine:cursorLine col:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3962
        self cursorCol:(cursorCol + aString size).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3963
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3964
    self makeCursorVisibleAndShowCursor:wasOn.
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
    "Created: / 9.6.1998 / 20:33:20 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3967
    "Modified: / 20.6.1998 / 19:41:02 / cg"
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
replaceTABAtCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3971
    "replace a single character at cursor-position by a TAB character"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3972
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3973
    |wasOn nextTab|
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
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3976
    nextTab := self nextTabAfter:cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3977
    self replaceStringAtCursor:(String new:(nextTab - cursorCol)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3978
    self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3979
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3980
    "Created: / 12.6.1998 / 21:53:23 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3983
selectWordBeforeCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3984
    "select the word to the left of cursor"
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
    |savCursorLine savCursorCol  beginCol beginLine endCol endLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3987
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3988
    savCursorLine := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3989
    savCursorCol := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3990
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3991
    endCol := cursorCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3992
    endLine := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3993
    self cursorToPreviousWord.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3994
    beginCol := cursorCol.     
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3995
    beginLine := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3996
    self cursorLine:savCursorLine col:savCursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3997
    self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3998
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3999
    "Created: / 14-06-2011 / 14:46:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4000
!
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
splitLine:lineNr before:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4003
    "split the line linNr before colNr; the right part (from colNr)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4004
     is cut off and inserted after lineNr; the view is redrawn"
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
    self basicSplitLine:lineNr before:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4007
    self addUndo:(DeleteRange line1:lineNr col1:colNr line2:lineNr+1 col2:0 info:'split').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4008
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4009
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4010
withoutRedrawAt:lineNr put:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4011
    "replace a line at lineNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4012
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4013
    |originalLine|
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
    originalLine := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4016
    self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4017
    super withoutRedrawAt:lineNr put:aString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4018
!
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
withoutRedrawInsertLine:aString before:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4021
    "insert the argument, aString before line lineNr; the string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4022
     becomes line lineNr; everything else is moved down; the view
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4023
     is not redrawn"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4024
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4025
    self basicWithoutRedrawInsertLines:{ aString } from:1 to:1 before:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4026
    self addUndo:(DeleteRange line1:lineNr col1:1 line2:lineNr+1 col2:0 info:'insert').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4027
!
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
withoutRedrawInsertLines:lines from:start to:end before:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4030
    "insert a bunch of lines before line lineNr; the view is not redrawn"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4031
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4032
    self basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4033
    self isReadOnly ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4034
        self addUndo:(DeleteRange line1:lineNr col1:1 line2:lineNr+end-start+1 col2:0 info:'insert').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4035
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4036
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4037
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4038
withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4039
    "insert aString (which has no crs) at lineNr/colNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4040
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4041
    self basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4042
    self addUndo:(DeleteRange line1:lineNr col1:colNr line2:lineNr col2:colNr+aString size-1 info:'insert').
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4045
wrapLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4046
    "wrap lines (insert line-break)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4047
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4048
    |lineLength answerString string|
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 checkModificationsAllowed ifFalse:[ ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4051
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4052
    self hasSelection ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4053
        self selectLine:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4054
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4055
    string := self selectionAsString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4056
    string isEmptyOrNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4057
        Dialog information:(resources string:'Nothing selected.').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4058
        ^ self.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4061
    answerString := Dialog request:(resources string:'Line length (wrap after how many chars)?') initialAnswer:80.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4062
    lineLength := Number readFrom:answerString onError:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4063
    lineLength isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4064
    lineLength < 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4065
        lineLength := 1.
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
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4069
        undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4070
            |inStream line col lineLen lastGoodCol lastStartCol word|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4071
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4072
            line := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4073
            col := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4074
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4075
            self cutSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4076
            self cursorLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4077
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4078
            lastGoodCol := col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4079
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4080
            inStream := string readStream.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4081
            [ inStream atEnd ] whileFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4082
                [inStream atEnd not and:[inStream peek isSeparator]] whileTrue:[ inStream next ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4083
                word := WriteStream on:(String new:10).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4084
                [inStream atEnd not and:[inStream peek isSeparator not]] whileTrue:[ word nextPut:inStream next ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4085
                (col + 1 + word size > lineLength) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4086
                    self insertCharAtCursor:(Character cr).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4087
                    col := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4088
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4089
                    col ~~ 1 ifTrue:[ 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4090
                        self insertStringAtCursor:' '.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4091
                        col := col + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4092
                    ]    
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4093
               ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4094
               self insertStringAtCursor:word contents.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4095
               col := col + word size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4096
            ].
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
        info:'Wrap'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4099
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4100
    "Modified: / 01-03-2012 / 19:56:22 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4103
!EditTextView methodsFor:'editing-basic'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4104
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4105
basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4106
    "delete characters from startCol to endCol in line lineNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4107
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4108
    |line lineSize newLine start stop prevWidth newWidth|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4109
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4110
    self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4111
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4112
    cursorLine == lineNr ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4113
        cursorCol >= startCol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4114
            cursorCol >= endCol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4115
                cursorCol := startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4116
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4117
                cursorCol := cursorCol - (endCol - startCol + 1).
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
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4120
    ].
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
    line := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4123
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4124
    (self checkModificationsAllowed and:[line notNil]) ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4125
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4126
    lineSize := line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4127
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4128
    startCol == 0 ifFalse:[ start := startCol ] ifTrue:[ start := 1 ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4129
    endCol > lineSize ifFalse:[ stop  := endCol ] ifTrue:[ stop  := lineSize ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4130
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4131
    stop >= start ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4132
        start ~~ 1 ifTrue:[ newLine := line copyFrom:1 to:(start-1) ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4133
                  ifFalse:[ newLine := '' ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4134
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4135
        stop == lineSize ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4136
            line bitsPerCharacter > newLine bitsPerCharacter ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4137
                newLine := line string species fromString:newLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4138
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4139
            newLine := newLine, (line copyFrom:(stop + 1) to:lineSize)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4140
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4141
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4142
        (trimBlankLines and:[newLine isBlank]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4143
            newLine := nil
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4146
        prevWidth := self widthOfLine:lineNr.
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 basicListAt:lineNr put:newLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4149
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4150
        (prevWidth = widthOfWidestLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4151
            "/ remember old width of this line,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4152
            "/ only clear widthOfWidestLine, if this lines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4153
            "/ length was (one of) the longest.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4154
            "/ avoids slow delete with huge texts.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4155
            widthOfWidestLine := nil.   "i.e. unknown"
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
            "/ scroll left if reqiured
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4158
            viewOrigin x > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4159
                newWidth := self widthOfLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4160
                newWidth < (viewOrigin x + width) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4161
                    self scrollHorizontalTo:(newWidth
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4162
                                             - width
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4163
                                             + margin + margin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4164
                                             + (gc font widthOf:'  '))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4165
                ]
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 textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4168
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4169
            self textChanged "/ textChangedButNoSizeChange
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4170
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4171
        gc font hasOverlappingCharacters ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4172
            self invalidateLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4173
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4174
            self redrawLine:lineNr from:start.
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
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4177
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4178
    "Modified: / 09-11-2010 / 13:42:45 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4179
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4180
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4181
basicDeleteFromLine:startLineNr toLine:endLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4182
    "delete some lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4183
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4184
    |wasOn nLines|
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
    self checkModificationsAllowed ifFalse:[ ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4187
    list isNil ifTrue:[^ self].
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
    wasOn := self hideCursor.
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
    "/ isnt this the same as:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4192
    "/ self deleteLinesWithoutRedrawFrom:startLineNr to:endLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4193
    startLineNr <= list size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4194
        self basicListRemoveFromIndex:startLineNr toIndex:(endLineNr min:list size).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4195
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4196
    "/ TODO: remember old maxwidth of linerange,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4197
    "/ only clear widthOfWidestLine, if this max
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4198
    "/ length was (one of) the longest.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4199
    "/ avoids slow delete with huge texts.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4200
    widthOfWidestLine := nil. "/ i.e. unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4201
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4202
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4203
    self redrawFromLine:startLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4204
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4205
    nLines := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4206
    (firstLineShown >= nLines) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4207
        self makeLineVisible:nLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4208
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4209
    wasOn ifTrue:[self showCursor].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4210
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4211
    "Modified: / 10-11-1998 / 23:55:05 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4212
    "Modified: / 18-03-2011 / 18:26:23 / az"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4213
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4214
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4215
basicDeleteLineWithoutRedraw:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4216
    "delete line - no redraw;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4217
     return true, if something was really deleted"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4218
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4219
    self checkModificationsAllowed ifFalse:[ ^ false].
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
    (list isNil or:[lineNr > list size]) ifTrue:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4222
    list removeIndex:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4223
    "/ TODO: remember old maxwidth of linerange,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4224
    "/ only clear widthOfWidestLine, if this max
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4225
    "/ length was (one of) the longest.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4226
    "/ avoids slow delete with huge texts.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4227
    widthOfWidestLine := nil. "/ i.e. unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4228
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4229
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4230
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4231
    "Modified: / 10.11.1998 / 23:53:24 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4232
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4233
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4234
basicInsert:aCharacter atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4235
    "insert a single character at lineNr/colNr;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4236
     set emphasis to character at current position"
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
    |line lineSize newLine drawCharacterOnly attribute oldClip x y|
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
    self checkModificationsAllowed ifFalse:[ ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4241
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4242
    aCharacter == (Character cr) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4243
        self splitLine:lineNr before:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4244
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4245
    ].
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
    drawCharacterOnly := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4248
    self checkForExistingLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4249
    line := list at:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4250
    lineSize := line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4251
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4252
    self st80EditMode ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4253
        (trimBlankLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4254
        and:[colNr > lineSize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4255
        and:[aCharacter == Character space]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4256
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4257
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4258
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4259
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4260
    (lineSize == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4261
        newLine := aCharacter asString species new:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4262
        drawCharacterOnly := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4263
    ] ifFalse: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4264
        (colNr > lineSize) ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4265
            colNr == (lineSize +1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4266
                attribute := line emphasisAt:lineSize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4267
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4268
            newLine := line species new:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4269
            newLine replaceFrom:1 to:lineSize with:line startingAt:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4270
            drawCharacterOnly := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4271
        ] ifFalse: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4272
            attribute := line emphasisAt:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4273
            newLine   := line species new:(lineSize + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4274
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4275
            newLine replaceFrom:1 to:(colNr - 1) with:line startingAt:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4276
            newLine replaceFrom:(colNr + 1) to:(lineSize + 1) with:line startingAt:colNr
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
    ].
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
    aCharacter asString bitsPerCharacter > newLine bitsPerCharacter ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4281
        newLine := aCharacter asString species fromString:newLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4282
        line isText ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4283
            newLine := newLine asText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4284
        ]
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
    newLine at:colNr put:aCharacter.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4287
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4288
    attribute notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4289
        newLine emphasisAt:colNr put:attribute.
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4292
    aCharacter == (Character tab) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4293
        newLine := self withTabsExpanded:newLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4294
        drawCharacterOnly := false
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4297
    self basicListAt:lineNr put:(newLine ifNil:[newLine] ifNotNil:[newLine asSingleByteStringIfPossible]).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4298
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4299
        widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine).
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
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4302
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4303
        "/ care for italic text - in this case, we must also
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4304
        "/ redraw the character before the insertion in order
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4305
        "/ to fix the slanted piece of the character.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4306
        "/ (but we must clip, to avoid destoying the character before)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4307
        (newLine notNil and:[newLine isText]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4308
            colNr > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4309
                cursorVisibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4310
                    oldClip := self clippingRectangleOrNil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4311
                    x := (self xOfCol:colNr-1 inVisibleLine:cursorVisibleLine) - viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4312
                    y := self yOfVisibleLine:cursorVisibleLine.
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
                    gc font hasOverlappingCharacters ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4315
                        self invalidateLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4316
                    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4317
                        drawCharacterOnly ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4318
                            self clippingRectangle:(x@y extent:((gc font width * 2) @ fontHeight)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4319
                            self redrawLine:lineNr from:colNr-1 to:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4320
                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4321
                            self clippingRectangle:(x@y extent:((width - x) @ fontHeight)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4322
                            self redrawLine:lineNr from:colNr-1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4323
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4324
                        self clippingRectangle:oldClip.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4325
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4326
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4327
                ^ self.
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
        gc font hasOverlappingCharacters ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4331
            self invalidateLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4332
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4333
            drawCharacterOnly ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4334
                self redrawLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4335
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4336
                self redrawLine:lineNr from:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4337
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4338
        ]
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4341
    "Modified: / 09-11-2010 / 13:43:18 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4342
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4343
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4344
basicListAt:lineNr put:newLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4345
    "redefinable for special subclasses (with virtual list)"
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
    list at:lineNr put:newLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4348
!
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
basicListRemoveFromIndex:startLineNr toIndex:endLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4351
    "redefinable for special subclasses (with virtual list)"
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
    list removeFromIndex:startLineNr toIndex:(endLineNr min:list size).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4354
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4355
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4356
basicMergeLine:lineNr removeBlanks:removeBlanks
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4357
    "merge line lineNr with line lineNr+1"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4358
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4359
    |leftPart rightPart bothParts nextLineNr i|
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
    (list notNil and:[(list size) >= lineNr]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4362
        "/ empty list or beyond end of text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4363
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4364
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4365
    leftPart := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4366
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4367
    leftPart isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4368
        leftPart := ''.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4369
        autoIndent ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4370
            (i := self leftIndentForLine:cursorLine) == 0 ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4371
                leftPart := String new:i
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4372
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4373
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4374
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4375
    self cursorLine:lineNr col:((leftPart size) + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4376
    nextLineNr := self validateCursorLine:(lineNr + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4377
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4378
    nextLineNr > (list size) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4379
        (rightPart := self listAt:nextLineNr) isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4380
            rightPart := ''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4381
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4382
            removeBlanks ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4383
                rightPart := rightPart withoutLeadingSeparators.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4384
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4385
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4386
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4387
        bothParts := leftPart , rightPart.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4388
        (trimBlankLines and:[bothParts isBlank]) ifTrue:[bothParts := nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4389
        self basicListAt:lineNr put:bothParts.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4390
        self redrawLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4391
        self deleteLine:nextLineNr
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
    "Created: 9.9.1997 / 09:27:38 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4395
    "Modified: 9.9.1997 / 09:28:27 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4398
basicReplace:aCharacter atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4399
    "replace a single character at lineNr/colNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4400
5045
6197bf1337fe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4988
diff changeset
  4401
    |line lineSize newLineSpecies newLine drawCharacterOnly|
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4402
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4403
    self checkModificationsAllowed ifFalse:[ ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4404
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4405
    aCharacter == (Character cr) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4406
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4407
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4408
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4409
    drawCharacterOnly := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4410
    self checkForExistingLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4411
    line := list at:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4412
    lineSize := line size.
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
    (trimBlankLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4415
    and:[colNr > lineSize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4416
    and:[aCharacter == Character space]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4417
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4418
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4419
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4420
    (lineSize == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4421
        newLine := aCharacter asString species new:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4422
    ] ifFalse: [
5045
6197bf1337fe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4988
diff changeset
  4423
        (aCharacter bitsPerCharacter > line bitsPerCharacter) ifTrue:[ 
6197bf1337fe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4988
diff changeset
  4424
            newLineSpecies := aCharacter stringSpecies
6197bf1337fe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4988
diff changeset
  4425
        ] ifFalse:[
6197bf1337fe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4988
diff changeset
  4426
            newLineSpecies := line species
6197bf1337fe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4988
diff changeset
  4427
        ].
6197bf1337fe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4988
diff changeset
  4428
        newLine := newLineSpecies new:(colNr max:lineSize).
6197bf1337fe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4988
diff changeset
  4429
        newLine replaceFrom:1 to:lineSize with:line startingAt:1.
5023
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
    newLine at:colNr put:aCharacter.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4432
    aCharacter == (Character tab) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4433
        newLine := self withTabsExpanded:newLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4434
        drawCharacterOnly := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4435
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4436
    self basicListAt:lineNr put:(newLine ifNil:[newLine] ifNotNil:[newLine asSingleByteStringIfPossible]).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4437
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4438
        widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4439
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4440
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4441
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4442
        gc font hasOverlappingCharacters ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4443
            self invalidateLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4444
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4445
            drawCharacterOnly ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4446
                self redrawLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4447
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4448
                self redrawLine:lineNr from:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4449
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4450
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4451
    ]
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
    "Created: / 06-03-1996 / 12:29:20 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4454
    "Modified: / 09-11-2010 / 13:42:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4455
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4456
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4457
basicReplaceString:aString atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4458
    "replace multiple characters starting at lineNr/colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4459
     This is not prepared to encounter special chars (except TAB)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4460
     in the string."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4461
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4462
    |line lineSize newLine endCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4463
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4464
    self checkModificationsAllowed ifFalse:[ ^ self].
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
    self checkForExistingLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4467
    line := list at:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4468
    lineSize := line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4469
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4470
    endCol := colNr + aString size - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4471
    (lineSize == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4472
        newLine := aString species new:endCol.
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
        (endCol > lineSize) ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4475
            aString isText ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4476
                newLine := aString species new:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4477
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4478
                newLine := line species new:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4479
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4480
            newLine replaceFrom:1 to:lineSize with:line startingAt:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4481
        ] ifFalse: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4482
            aString isText ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4483
                newLine := aString species new:line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4484
                newLine replaceFrom:1 to:lineSize with:line startingAt:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4485
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4486
                newLine := line copy.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4487
            ]
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
    newLine replaceFrom:colNr with:aString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4491
    (aString includes:(Character tab)) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4492
        newLine := self withTabsExpanded:newLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4493
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4494
    self basicListAt:lineNr put:(newLine ifNil:[newLine] ifNotNil:[newLine asSingleByteStringIfPossible]).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4495
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4496
        widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine).
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
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4499
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4500
        gc font hasOverlappingCharacters ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4501
            self invalidateLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4502
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4503
            self redrawLine:lineNr from:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4504
        ]
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4507
    "Created: / 11-06-1998 / 10:38:32 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4508
    "Modified: / 09-11-2010 / 13:42:56 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4509
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4510
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4511
basicSplitLine:lineNr before:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4512
    "split the line linNr before colNr; the right part (from colNr)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4513
     is cut off and inserted after lineNr; the view is redrawn"
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
    |line lineSize leftRest rightRest visLine w h mustWait
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4516
     srcY    "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4517
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4518
    list isNil ifTrue:[ ^ self ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4519
    lineNr > (list size) ifTrue:[ ^ self ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4520
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4521
    (colNr == 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4522
        self nonUndoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4523
            self insertLine:nil before:lineNr.
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
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4526
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4527
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4528
    line := list at:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4529
    line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4530
        lineSize := line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4531
        (colNr <= lineSize) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4532
            rightRest := line copyFrom:colNr to:lineSize.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4533
            (colNr > 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4534
                leftRest := line copyTo:(colNr - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4535
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4536
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4537
            leftRest := line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4538
        ]
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
    leftRest notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4541
        (trimBlankLines and:[leftRest isBlank]) ifTrue:[leftRest := nil]
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
    self basicListAt:lineNr put:leftRest.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4544
    self nonUndoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4545
        self withoutRedrawInsertLine:rightRest before:(lineNr + 1).
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
    visLine := self listLineToVisibleLine:(lineNr).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4548
    visLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4549
        w := self widthForScrollBetween:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4550
                                    and:(firstLineShown + nLinesShown).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4551
        srcY := topMargin + (visLine * fontHeight).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4552
        h := ((nLinesShown - visLine - 1) * fontHeight).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4553
        (mustWait := (w > 0 and:[h > 0])) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4554
            self catchExpose.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4555
            self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4556
                copyFrom:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4557
                x:textStartLeft y:srcY
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4558
                toX:textStartLeft y:(srcY + fontHeight)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4559
                width:w
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4560
                height:((nLinesShown - visLine - 1) * fontHeight)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4561
                async:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4562
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4563
        self redrawLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4564
        self redrawLine:(lineNr + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4565
        mustWait ifTrue:[self waitForExpose]
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
    widthOfWidestLine := nil. "/ unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4568
    self textChanged.
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
    "Modified: / 06-12-2010 / 13:12:55 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4571
!
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
basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4574
    "insert a bunch of lines before line lineNr; the view is not redrawn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4575
     Tabs are expanded here with a tab=8 setting (independent of any editor-setting,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4576
     because the text might have been pasted from an alien view."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4577
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4578
    |newLine newLines nLines|
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
    nLines := end - start + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4581
    newLines := Array new:(lines size).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4582
    start to:end do:[:index |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4583
        newLine := lines at:index.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4584
        newLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4585
            newLine isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4586
                newLine isBlank ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4587
                    newLine := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4588
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4589
                    (newLine includes:(Character tab)) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4590
                        newLine := self withTabs:(ListView tab8Positions) expand:newLine
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
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4594
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4595
        newLines at:index put:newLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4596
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4597
    list isNil ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4598
        list := StringCollection new:(lineNr + nLines + 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4599
    ] ifFalse: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4600
        list grow:((list size + nLines) max:(lineNr + nLines - 1))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4601
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4602
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4603
    "I have changed 'replaceFrom:to:with:startingAt:' to correctly handle
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4604
     overlapping copy - if it didn't, we had to use:"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4605
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4606
    index := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4607
    [index > lineNr] whileTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4608
        pIndex := index - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4609
        list at:index put:(list at:pIndex).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4610
        index := pIndex
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4611
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4612
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4613
    list replaceFrom:(lineNr + nLines) to:(list size) with:list startingAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4614
    list replaceFrom:lineNr to:(lineNr + nLines - 1) with:newLines startingAt:start.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4615
    self contentsChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4616
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4617
    "Modified: / 07-10-2011 / 15:55:18 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4618
!
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
basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4621
    "insert aString (which has no crs) at lineNr/colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4622
     Tabs are expanded here with a tab=8 setting (independent of any editor-setting,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4623
     because the text might have been pasted from an alien view."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4624
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4625
    |isText strLen line lineSize newLine stringType sz lineCharWidth stringCharWidth|
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
    (aString isNil) ifTrue:[ ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4628
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4629
    strLen := aString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4630
    self checkForExistingLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4631
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4632
    stringType := aString string species.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4633
    isText     := aString isText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4634
    line       := list at:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4635
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4636
    line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4637
        lineSize := line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4638
        line isString ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4639
            stringType := line species
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4640
        ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4641
            lineCharWidth := line bitsPerCharacter.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4642
            stringCharWidth := aString bitsPerCharacter.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4643
            lineCharWidth > stringCharWidth ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4644
                stringType := line string species
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4645
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4646
                stringCharWidth > lineCharWidth ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4647
                    stringType := aString string species
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
            line isText ifTrue:[ isText := true ]
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
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4653
        lineSize := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4654
    ].
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
    ((colNr == 1) and:[lineSize == 0]) ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4657
        newLine := aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4658
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4659
        (lineSize == 0 or:[colNr > lineSize]) ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4660
            sz := colNr + strLen - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4661
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4662
            sz := lineSize + strLen
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
        newLine := stringType new:sz.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4666
        isText ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4667
            newLine := Text string:newLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4668
        ].
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
        (lineSize ~~ 0) ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4671
            (colNr > lineSize) ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4672
                newLine replaceFrom:1 to:lineSize with:line startingAt:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4673
            ] ifFalse: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4674
                newLine replaceFrom:1 to:(colNr - 1) with:line startingAt:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4675
                newLine replaceFrom:(colNr + strLen) to:(lineSize + strLen) with:line startingAt:colNr
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
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4678
        newLine replaceFrom:(colNr max:1) to:(colNr + strLen - 1) with:aString startingAt:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4679
    ].
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
    (aString includes:(Character tab)) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4682
        newLine := self withTabs:(ListView tab8Positions) expand:newLine
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
    self basicListAt:lineNr put:(newLine ifNil:[newLine] ifNotNil:[newLine asSingleByteStringIfPossible]).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4686
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4687
        widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4688
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4689
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4690
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4691
    "Modified: / 25-01-2012 / 00:37:29 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4692
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4693
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4694
!EditTextView methodsFor:'event handling'!
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
buttonPress:button x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4697
    "hide the cursor when button is activated"
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
    hasKeyboardFocus := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4700
    dragIsActive := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4701
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4702
    completionSupport notNil ifTrue:[ 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4703
        "/ also give that guy a chance to close its popup view
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4704
        completionSupport buttonPress:button x:x y:y
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
    cursorShown ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4708
        self drawCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4709
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4710
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4711
    "On X11, be nice and paste PRIMARY when middle click. 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4712
     Note, that middle button on X11 is translated to button
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4713
     128 in Smalltalk/X - see XWorkstation class>>initializeConstants"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4714
    (button == #paste and:[self graphicsDevice platformName == #X11]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4715
        self undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4716
            self paste: (self getClipboardText:#selection).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4717
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4718
        ^self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4719
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4720
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4721
    (button == 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4722
        self hideCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4723
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4724
"/ some very old code from times, when a right-click was a paste in X11
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
"/    (button == #paste) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4727
"/        self pasteOrReplace.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4728
"/        ^ self
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
    super buttonPress:button x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4731
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4732
    "Modified: / 23-03-1999 / 13:51:40 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4733
    "Modified (comment): / 17-04-2012 / 21:02:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4736
buttonRelease:button x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4737
    "move the cursor to the click-position of previous button press"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4738
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4739
    |x1 x2 x2_3 newCursorCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4740
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4741
    (button == 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4742
        typeOfSelection := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4743
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4744
        dragIsActive ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4745
            self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4746
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4747
        selectionStartLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4748
            clickCol notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4749
                self cursorMovementAllowed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4750
                    newCursorCol := clickCol.
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
                    cursorType ~~ #block ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4753
                        clickPos notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4754
                            "/ we do something special, if the text-cursor's type is not a block-cursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4755
                            "/ (i.e. if its an ibeam).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4756
                            "/ adjust clickCol if the user clicked in the right third of a character.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4757
                            x1 := self xOfCol:clickCol inVisibleLine:clickLine.  
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4758
                            x2 := self xOfCol:clickCol+1 inVisibleLine:clickLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4759
                            x2_3 := x1 + ((x2-x1) * (2/3)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4760
                            (clickPos x >= x2_3) ifTrue:[ newCursorCol := clickCol+1 ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4761
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4762
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4763
                    self cursorLine:clickLine col:newCursorCol.
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
                true "self hadSelectionBeforeClick not" ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4766
                    list notEmptyOrNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4767
                        UserPreferences current selectAllWhenClickingBeyondEnd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4768
                            (clickLine >= list size) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4769
                                (clickLine > (self list size + 2) 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4770
                                or:[ clickCol > (list last size + 5) ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4771
                                    self selectAll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4772
                                ].
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
                        ]
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
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4777
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4778
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4779
            lastStringFromReplaceForNextSearch := nil.  "new selection invalidates remembered string"
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
        self showCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4782
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4783
    super buttonRelease:button x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4784
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4785
    "Modified: / 07-03-2012 / 18:48:37 / cg"
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
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4788
cursorKeyPress:key shifted:shifted
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4789
    <resource: #keyboard (#CursorRight #CursorDown #CursorUp #CursorDown)>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4790
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4791
    | n oldTypeOfSelection |
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4792
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4793
    oldTypeOfSelection := typeOfSelection.
5023
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
    self changeTypeOfSelectionTo:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4796
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4797
    (key == #CursorRight) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4798
        (shifted and:[selectionStartLine isNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4799
            selectionStartLine := selectionEndLine := clickStartLine := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4800
            selectionStartCol := selectionEndCol := clickStartCol := cursorCol.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4801
            cursorCol := cursorCol + 1.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4802
            expandingTop := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4803
            self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4804
            self setPrimarySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4805
            self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4806
            self redrawLine:selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4807
            ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4808
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4809
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4810
        self cursorMovementAllowed ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4811
            shifted ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4812
                self addToSelectionAfter:[ self cursorRight ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4813
            ] ifFalse:[
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4814
                "/ Compensate for Claus paste-cursordown-paste feature.
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4815
                "/ Right after paste the cursor is at the beginning of the
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4816
                "/ selection. But if immediately after paste user moves cursor right
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4817
                "/ (but without shift!!!!!!), she probably wants to move past the 
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4818
                "/ pasted text, not into it. This is how every other editor behaves.
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4819
                oldTypeOfSelection == #paste ifTrue:[
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4820
                    cursorLine := selectionEndLine.
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4821
                    cursorCol := selectionEndCol + 1.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4822
                ].
4975
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4823
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4824
                "/ If there's selection, unselect and move cursor
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4825
                "/ to the end of selection.
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4826
                self hasSelection ifTrue:[ 
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4827
                    self setCursorLine: selectionEndLine.
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4828
                    self setCursorCol: selectionEndCol + 1.
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4829
                    self unselect; makeCursorVisible.
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4830
                    ^ self.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4831
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4832
                self unselect; makeCursorVisible.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4833
                self cursorRight.
5023
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
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4836
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4837
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4838
    (key == #CursorDown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4839
        (shifted and:[selectionStartLine isNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4840
            selectionStartLine := clickStartLine := cursorLine. selectionEndLine := cursorLine + 1.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4841
            selectionStartCol := clickStartCol := cursorCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4842
            selectionEndCol := cursorCol - 1.
4970
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  4843
"/            selectionEndCol == 1 ifTrue:[
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  4844
"/                selectionEndCol := 0.
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  4845
"/            ].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4846
            self setCursorLine: cursorLine + 1.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4847
            self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4848
            self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4849
            self redrawLine:selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4850
            expandingTop := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4851
            self redrawLine:selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4852
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4853
        ].
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
        selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4856
            self cursorMovementAllowed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4857
                "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4858
                "/ treat the whole selection as cursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4859
                "/
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4860
"/                self setCursorLine:(selectionEndLine ? selectionStartLine).
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4861
"/                self setCursorCol:selectionStartCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4862
"/                (cursorCol == 0 or:[selectionEndCol == 0]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4863
"/                    self setCursorCol:1.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4864
"/                    self setCursorLine:(cursorLine - 1).
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4865
"/                ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4866
"/                self makeCursorVisible.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4867
"/
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4868
"/                shifted ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4869
"/                    clickLine := cursorLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4870
"/                    clickCol := cursorCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4871
"/                    self setCursorLine: cursorLine + 1.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4872
"/                    self expandSelectionDown.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4873
"/                    ^ self
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4874
"/                ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4875
"/                self unselect.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4876
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4877
        ].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4878
        self cursorMovementAllowed ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4879
            n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorDown).
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4880
            shifted ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4881
                self addToSelectionAfter:[ self cursorDown:n ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4882
            ] ifFalse:[
4975
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4883
                "/ If there's selection, unselect and move cursor
4977
d0e0234d922c Fix for select & CursorDown press (non-shift)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4976
diff changeset
  4884
                "/ one line below last selection line but at the
d0e0234d922c Fix for select & CursorDown press (non-shift)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4976
diff changeset
  4885
                "/ selectionStartCol column. This behavior is
d0e0234d922c Fix for select & CursorDown press (non-shift)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4976
diff changeset
  4886
                "/ useful when pasting...
4975
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4887
                self hasSelection ifTrue:[ 
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4888
                    self setCursorLine: selectionEndLine.
4977
d0e0234d922c Fix for select & CursorDown press (non-shift)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4976
diff changeset
  4889
                    self setCursorCol: selectionStartCol.
4975
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4890
                ].    
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4891
                self unselect; makeCursorVisible.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4892
                self cursorDown:n.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4893
            ].  
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4894
            "/
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4895
            "/ flush keyboard to avoid runaway cursor
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4896
            "/
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4897
            self sensor flushKeyboardFor:self.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4898
        ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4899
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4900
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4901
    (key == #CursorLeft or:[key == #CursorUp]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4902
        (shifted and:[selectionStartLine isNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4903
            expandingTop := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4904
            key == #CursorLeft ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4905
                cursorCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4906
                    selectionStartLine := selectionEndLine := clickStartLine := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4907
                    selectionEndCol := clickStartCol := cursorCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4908
                    selectionStartCol := cursorCol-1.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4909
                    self setCursorCol: cursorCol-1.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4910
                    self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4911
                    self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4912
                    self redrawLine:selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4913
                    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4914
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4915
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4916
                cursorLine > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4917
                    selectionEndLine := clickStartLine := cursorLine.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4918
                    selectionStartCol := clickStartCol := cursorCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4919
                    selectionEndCol := cursorCol - 1.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4920
                    selectionStartLine := cursorLine - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4921
                    selectionEndCol == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4922
                        selectionEndCol := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4923
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4924
                    self validateNewSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4925
                    self selectionChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4926
                    self redrawFromLine:selectionStartLine to:cursorLine.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4927
                    self setCursorLine: cursorLine - 1.  
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4928
                    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4929
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4930
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4931
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4932
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4933
        self hasSelection ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4934
            self cursorMovementAllowed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4935
                "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4936
                "/ treat the whole selection as cursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4937
                "/
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4938
"/                self setCursorLine:selectionStartLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4939
"/                self setCursorCol:selectionStartCol.
4975
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4940
"/                self makeCursorVisible.
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4941
"/
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4942
"/                shifted ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4943
"/                    self unselect.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4944
"/                ]
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4945
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4946
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4947
        (key == #CursorLeft) ifTrue:[
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4948
            shifted ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4949
                self addToSelectionAfter:[self cursorLeft].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4950
            ] ifFalse:[
4975
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4951
                "/ If there's selection, unselect and move cursor
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4952
                "/ to the end of selection.   
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4953
                self hasSelection ifTrue:[ 
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4954
                    self setCursorLine:selectionStartLine.
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4955
                    self setCursorCol:selectionStartCol.
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4956
                    self unselect; makeCursorVisible.                    
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4957
                    ^ self.
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4958
                ].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4959
                self unselect; makeCursorVisible.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4960
                self cursorLeft. 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4961
            ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4962
            ^self
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4963
        ].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4964
        (key == #CursorUp) ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4965
            n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorUp).
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4966
            shifted ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4967
                self addToSelectionAfter: [ self cursorUp:n ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4968
            ] ifFalse:[
4975
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4969
                "/ If there's selection, unselect and move cursor
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4970
                "/ to the beggining of selection.   
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4971
                self hasSelection ifTrue:[ 
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4972
                    self setCursorLine:selectionStartLine.
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4973
                    self setCursorCol:selectionStartCol.
bee454945bf7 Bugfix for cursor position after non-shifter cursor key press while having selection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4974
diff changeset
  4974
                ].    
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4975
                self unselect; makeCursorVisible.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4976
                self cursorUp:n.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4977
            ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4978
            "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4979
            "/ flush keyboard to avoid runaway cursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4980
            "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4981
            self sensor flushKeyboardFor:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4982
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4983
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4984
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4985
4977
d0e0234d922c Fix for select & CursorDown press (non-shift)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4976
diff changeset
  4986
    "Modified: / 28-03-2014 / 12:32:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4987
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4988
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4989
doKeyPress:key x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4990
    "handle keyboard input"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4991
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4992
    <resource: #keyboard (#Paste #Insert #PasteFromHistory #Cut #Again #AgainForAll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4993
                          #Replace #Undo #Redo #Accept
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4994
                          #Delete #BasicDelete #BackSpace #BasicBackspace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4995
                          #DeleteSpaces #Join
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4996
                          #SearchMatchingParent #SelectMatchingParents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4997
                          #SelectWord #ExpandSelectionByWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4998
                          #SelectToEnd #SelectFromBeginning
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4999
                          #SelectLine #ExpandSelectionByLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5000
                          #BeginOfLine #EndOfLine #NextWord #PreviousWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5001
                          #CursorRight #CursorDown #CursorLeft #CursorUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5002
                          #Return #Tab #BackTab #NonInsertingTab #Escape
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5003
                          #GotoLine #BeginOfText #EndOfText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5004
                          #InsertLine #DeleteLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5005
                          #SelectLineFromBeginning
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5006
                          #LearnKeyboardMacro #ExecuteKeyboardMacro #ToggleInsertMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5007
                          #OpenSpecialCharacterWindow
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5008
                          #'F*' #'f*')>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5009
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5010
    |fKeyMacros shiftPressed ctrlPressed i event macroName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5011
     immediateCompletion currentUserPrefs|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5012
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5013
    currentUserPrefs := UserPreferences current.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5014
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5015
    "/ experimental
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5016
    immediateCompletion := currentUserPrefs immediateCodeCompletion.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5017
    (immediateCompletion 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5018
    or:[currentUserPrefs codeCompletionOnControlKey
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5019
    or:[currentUserPrefs codeCompletionOnTabKey]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5020
        completionSupport isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5021
            self initializeCompletionSupport.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5022
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5023
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5024
    "/ JV: why setting it to nil here?
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5025
"/    ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5026
"/        completionService := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5027
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5028
    completionSupport notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5029
        (completionSupport handleKeyPress:key x:x y:y) ifTrue:["eaten" ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5030
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5031
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5032
    key isSymbol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5033
        (self graphicsDevice modifierKeys includes:key) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5034
            lastReplacementInfo stillCollectingInput:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5035
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5036
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5037
    (key == #LearnKeyboardMacro) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5038
        lastReplacementInfo stillCollectingInput:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5039
        self toggleLearnMode.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5040
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5041
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5042
    (key == #ExecuteKeyboardMacro) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5043
        lastReplacementInfo stillCollectingInput:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5044
        self executeLearnedKeyboardMacro.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5045
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5046
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5047
    (key == #Undo) ifTrue:[self undo. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5048
    (key == #Redo) ifTrue:[self redo. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5049
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5050
    self learnMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5051
        event := WindowGroup lastEventQuerySignal query.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5052
        learnedMacro add:event.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5053
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5054
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5055
    (self executekeyboardMacroNamed:key) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5056
        "the macro named key exists"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5057
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5058
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5059
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5060
    key isSymbol ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5061
        "the usual case: key is a character, but maybe a string also (in X11)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5062
        self handleNonCommandKey:key.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5063
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5064
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5065
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5066
    event isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5067
        event := WindowGroup lastEventQuerySignal query.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5068
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5069
    shiftPressed := event hasShift.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5070
    ctrlPressed := event hasCtrl and:[(event rawKey asString startsWith:'Ctrl') not].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5071
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5072
    (key == #DeleteWordBeforeCursor) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5073
        self deleteWordBeforeCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5074
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5075
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5076
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5077
    (key == #BackSpace or:[key == #BasicBackspace]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5078
        selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5079
            ((key == #BasicBackspace)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5080
            or:[ currentUserPrefs deleteSetsClipboardText not ])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5081
            ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5082
                self deleteSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5083
            ] ifFalse: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5084
                self copyAndDeleteSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5085
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5086
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5087
            self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5088
"/          (shiftPressed and:[ ctrlPressed ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5089
"/            self deleteWordBeforeCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5090
"/          ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5091
            self deleteCharBeforeCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5092
"/          ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5093
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5094
        true "immediateCompletion" ifTrue:[ 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5095
            completionSupport notNil ifTrue:[ completionSupport postKeyPress:key].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5096
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5097
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5098
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5099
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5100
    (key == #ToggleAutoIndent) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5101
        self autoIndent:(autoIndent not).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5102
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5103
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5104
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5105
    key == #ToggleInsertMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5106
        self insertMode:(editMode value == EditMode insertMode) not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5107
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5108
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5109
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5110
    key == #OpenSpecialCharacterWindow ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5111
        CharacterSetView notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5112
            self specialCharacters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5113
            ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5114
        ]        
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5115
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5116
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5117
    replacing := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5118
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5119
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5120
     Fn      pastes a key-sequence (but only if not overlayed with
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5121
             another function in the keyboard map)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5122
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5123
     see TextView>>:x:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5124
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5125
    (key at:1) asLowercase == $f ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5126
        (('[fF][0-9]' match:key)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5127
        or:['[fF][0-9][0-9]' match:key]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5128
            shiftPressed ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5129
                fKeyMacros := currentUserPrefs functionKeySequences.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5130
                fKeyMacros notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5131
                    (fKeyMacros includesKey:key) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5132
                        self pasteOrReplace:(fKeyMacros at:key) asStringCollection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5133
                        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5134
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5135
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5136
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5137
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5138
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5139
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5140
    (key == #'Ctrl8' or:[key == #'Ctrl9']) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5141
        self parenthizeSelectionWith:$( and:$).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5142
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5143
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5144
    (key == #'Ctrl2') ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5145
        self parenthizeSelectionWith:$" and:$".
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5146
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5147
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5148
    (key == #'Ctrl#') ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5149
        self parenthizeSelectionWith:$' and:$'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5150
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5151
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5152
    (key == #'ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst') ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5153
        self convertSelectionToLowercaseOrUppercaseOrUppercaseFirst.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5154
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5155
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5156
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5157
    (key == #Accept)  ifTrue:[^ self accept].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5158
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5159
    ((key == #Paste) or:[key == #Insert or:[key == #PasteFromHistory]]) ifTrue:[self pasteOrReplace. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5160
    (key == #Cut) ifTrue:[self cut. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5161
    (key == #Again) ifTrue:[self again. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5162
    (key == #AgainForAll) ifTrue:[self multipleAgain. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5163
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5164
    (key == #Join) ifTrue:[self joinLines. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5165
    (key == #Replace) ifTrue:[self replace. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5166
    (key == #ExpandSelectionByWord) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5167
        self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5168
        self findNextWordAfterSelectionAndAddToSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5169
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5170
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5171
    (key == #SelectWord) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5172
        self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5173
        self selectWordUnderCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5174
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5175
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5176
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5177
    (key == #SearchMatchingParent) ifTrue:[self searchForMatchingParenthesis. ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5178
    (key == #SelectMatchingParents) ifTrue:[self searchForAndSelectMatchingParenthesis. ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5179
    (key == #SelectToEnd) ifTrue:[self selectUpToEnd. ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5180
    (key == #SelectFromBeginning) ifTrue:[self selectFromBeginning. ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5181
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5182
" disabled - nobody liked it ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5183
  and if you like it, its better done in the keymap.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5184
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5185
    (key == #Ctrlb) ifTrue:[self unselect. self cursorLeft. ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5186
    (key == #Ctrlf) ifTrue:[self unselect. self cursorRight. ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5187
    (key == #Ctrln) ifTrue:[self unselect. self cursorDown. ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5188
    (key == #Ctrlp) ifTrue:[self unselect. self cursorUp. ^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5189
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5190
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5191
    (key == #BeginOfLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5192
        shiftPressed ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5193
            "/ "Original St/X code - now use Ctrl modifier"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5194
            "/ self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5195
            "/ self cursorHome.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5196
            "Jan's modification"
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  5197
            self addToSelectionAfter:[ self cursorToBeginOfLine ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5198
            "/ Jan's modification modified by his own request ;-))
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  5199
            "/ JV: Well, does not work correctly. Better to fix addToSelectionAfter: 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  5200
            "/ self selectFromBeginOfLine.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5201
        ] ifFalse: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5202
            self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5203
            ctrlPressed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5204
                self cursorHome.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5205
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5206
                self cursorToBeginOfLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5207
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5208
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5209
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5210
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5211
    (key == #EndOfLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5212
        shiftPressed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5213
            "/ "Original St/X code - now use Ctrl modifier"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5214
            "/ self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5215
            "/ self cursorToBottom
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5216
            " Jan's modification"
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  5217
            self addToSelectionAfter:[ self cursorToEndOfLine ] .
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5218
            "/ Jan's modification modified by his own request ;-))
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  5219
            "/ JV: Well, does not work correctly. Better to fix addToSelectionAfter:
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  5220
            "/  self selectToEndOfLine.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5221
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5222
            self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5223
            ctrlPressed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5224
                self cursorToBottom
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5225
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5226
                self cursorToEndOfLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5227
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5228
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5229
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5230
    ].
4978
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5231
    (key == #NextWord) ifTrue:[
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5232
        shiftPressed ifTrue:[
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5233
            self addToSelectionAfter:[  
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5234
                self cursorToNextWord. 
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5235
            ]
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5236
        ] ifFalse:[ 
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5237
            self cursorToNextWord
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5238
        ].
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5239
        ^self
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5240
    ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5241
    (key == #EndOfWord) ifTrue:[self cursorToEndOfWord. ^self].
4978
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5242
    (key == #PreviousWord) ifTrue:[
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5243
        shiftPressed ifTrue:[
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5244
            self addToSelectionAfter:[      
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5245
                self cursorToPreviousWord. 
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5246
            ]
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5247
        ] ifFalse:[ 
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5248
            self cursorToPreviousWord.                                
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5249
        ].
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5250
        ^self
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5251
    ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5252
    (key == #GotoLine) ifTrue:[self gotoLine. ^self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5253
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5254
    (key == #CursorRight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5255
    or:[key == #CursorDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5256
    or:[key == #CursorLeft
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5257
    or:[key == #CursorUp]]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5258
        self cursorKeyPress:key shifted:shiftPressed.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5259
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5260
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5261
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5262
    (key == #NonInsertingReturn) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5263
        self unselect. self cursorReturn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5264
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5265
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5266
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5267
    (key == #Return) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5268
        shiftPressed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5269
            self unselect. self cursorReturn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5270
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5271
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5272
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5273
        self isReadOnly ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5274
            self unselect; makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5275
            self cursorReturn
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5276
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5277
            self isInInsertMode ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5278
                self cursorReturn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5279
                autoIndent == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5280
                    i := self leftIndentForLine:(cursorLine + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5281
                    (self listAt:cursorLine) isEmptyOrNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5282
                        self cursorCol:(i+1 max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5283
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5284
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5285
            ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5286
                |left right oldIndent|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5287
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5288
                "/ old version just unselected ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5289
                "/ self unselect; makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5290
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5291
                "/ new version deletes ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5292
                typeOfSelection == #paste ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5293
                    self unselect; makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5294
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5295
                    self copyAndDeleteSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5296
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5297
                left := (self listAt:cursorLine to:cursorCol-1) ? ''.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5298
                right := (self listAt:cursorLine from:cursorCol) ? ''.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5299
                self insertCharAtCursor:(Character cr).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5300
                autoIndent == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5301
                    (right isEmpty and:[cursorCol ~~ 1]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5302
                        "/ nothing to do.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5303
                    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5304
                        ((self listAt:cursorLine) isEmptyOrNil 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5305
                        or:[ cursorCol == 1 ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5306
                            i := (self leftIndentForLine:cursorLine).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5307
                            left := left withoutSeparators.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5308
                            right := right withoutSeparators.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5309
                            (left endsWith:'[') ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5310
"/                                i := i + 4.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5311
                            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5312
                                (false "(left endsWith:']')" or:[(right startsWith:']')]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5313
                                    i := i - 4.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5314
                                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5315
                            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5316
                            oldIndent := self leftIndentOfLine:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5317
                            self indentFromLine:cursorLine toLine:cursorLine by:(i-oldIndent).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5318
                            self st80EditMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5319
                                (self listAt:cursorLine) size < i ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5320
                                    self insertStringAtCursor:(String new:((i-oldIndent) max:0)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5321
                                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5322
                            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5323
                            self cursorCol:(i+1 max:1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5324
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5325
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5326
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5327
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5328
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5329
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5330
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5331
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5332
    (key == #NonInsertingTab) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5333
        self unselect. self cursorTab.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5334
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5335
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5336
    ((key == #BackTab) or:[(key == #Tab)]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5337
        self tabMeansNextField ifTrue:[^ super keyPress:key x:x y:y].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5338
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5339
        self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5340
            selectStyle == #line ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5341
                ((key == #Tab) and:[shiftPressed not]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5342
                    macroName := #IndentBy4.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5343
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5344
                    macroName := #UndentBy4.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5345
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5346
                macroName notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5347
                    self executekeyboardMacroNamed:macroName.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5348
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5349
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5350
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5351
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5352
        self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5353
        (key == #Tab) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5354
            (shiftPressed or:[self isInInsertMode not]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5355
                self cursorTab.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5356
                ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5357
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5358
            self insertTabAtCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5359
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5360
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5361
        self cursorBacktab.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5362
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5363
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5364
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5365
    "/ key == #DeleteSpaces ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5366
    (key == #Delete) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5367
        shiftPressed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5368
            [(cursorCol <= (self listAt:cursorLine) size)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5369
             and:[self characterUnderCursor isSeparator]] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5370
             self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5371
                self deleteCharAtCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5372
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5373
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5374
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5375
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5376
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5377
    (key == #Delete
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5378
     or:[key == #BasicDelete]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5379
        selectionStartLine notNil ifTrue:[  
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5380
"/          Again function is not supporting Delete action (on purpose, to avoid replacing the next search string)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5381
"/          To remove text repetetively, use Cut instead.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5382
"/            self setLastStringToReplace: self selection asStringWithoutFinalCR.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5383
"/            lastReplacementInfo lastReplacement: nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5384
            ((key == #BasicDelete)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5385
            or:[currentUserPrefs deleteSetsClipboardText not]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5386
                self deleteSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5387
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5388
                self copyAndDeleteSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5389
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5390
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5391
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5392
        self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5393
        self deleteCharAtCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5394
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5395
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5396
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5397
    (key == #BeginOfText) ifTrue:[     "i.e. HOME"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5398
        self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5399
        cursorVisibleLine == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5400
            self cursorHome.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5401
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5402
            self cursorToFirstVisibleLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5403
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5404
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5405
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5406
    (key == #EndOfText) ifTrue:[       "i.e. END"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5407
        self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5408
        cursorVisibleLine == nFullLinesShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5409
            self cursorToBottom.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5410
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5411
            self cursorToLastVisibleLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5412
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5413
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5414
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5415
    ((key == #Escape)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5416
    or:[key == #SelectLineFromBeginning]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5417
        self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5418
        self unselect. self selectCursorLineFromBeginning.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5419
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5420
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5421
    (key == #SelectLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5422
        self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5423
        self unselect. self selectCursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5424
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5425
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5426
    (key == #ExpandSelectionByLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5427
        "/ self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5428
        self selectExpandCursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5429
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5430
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5431
    (key == #DeleteLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5432
        self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5433
        self unselect. self deleteCursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5434
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5435
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5436
    (key == #InsertLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5437
        self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5438
        self unselect. self insertLine:nil before:cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5439
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5440
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5441
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5442
    super keyPress:key x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5443
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5444
    "Modified: / 06-02-1998 / 11:59:59 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5445
    "Modified: / 14-07-2011 / 12:08:28 / cg"
4978
0eb26aed1456 Fix for Ctrl-Shift-Left/Right (Shift-NextWord / PreviousWord)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4977
diff changeset
  5446
    "Modified: / 31-03-2014 / 16:27:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5447
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5448
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5449
executeKeyboardMacro:cmdMacro
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5450
    Error handle:[:ex |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5451
        self warn:'Error in keyboard macro: ' , ex description.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5452
        ex return.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5453
    ] do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5454
        AbortOperationRequest handle:[:ex |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5455
            self warn:'Keyboard macro aborted'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5456
            ex return.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5457
        ] do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5458
            Parser
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5459
                evaluate:cmdMacro asString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5460
                receiver:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5461
                notifying:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5462
                compile:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5463
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5464
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5465
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5466
4970
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  5467
extendSelectionToX:x y:y setPrimarySelection: primary
4843
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5468
    "mouse-move while button was pressed - handle selection changes"
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5469
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5470
    " Overwritten here to move cursor position to start/end of the
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5471
      selection, whichever changes"
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5472
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5473
    | oldClickLine oldClickCol newCursorLine newCursorCol |
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5474
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5475
    oldClickLine := clickStartLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5476
    oldClickCol := clickStartCol.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5477
4970
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  5478
    super extendSelectionToX:x y:y setPrimarySelection: primary.
4843
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5479
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5480
    self hasSelection ifFalse: [ ^ self ].
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5481
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5482
    clickLine < oldClickLine ifTrue:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5483
        newCursorCol := selectionStartCol.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5484
        newCursorLine := selectionStartLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5485
    ] ifFalse:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5486
        clickLine == oldClickLine ifTrue:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5487
            clickCol < oldClickCol ifTrue:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5488
                newCursorLine := selectionStartLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5489
                newCursorCol := selectionStartCol.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5490
            ] ifFalse:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5491
                clickCol == oldClickCol ifTrue:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5492
                    newCursorLine := selectionStartLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5493
                    newCursorCol := selectionStartCol.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5494
                ] ifFalse:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5495
                    newCursorLine := selectionEndLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5496
                    newCursorCol := selectionEndCol + 1
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5497
                ]
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5498
            ]
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5499
        ] ifFalse:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5500
            newCursorLine := selectionEndLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5501
            newCursorCol := selectionEndCol + 1.       
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5502
        ]
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5503
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5504
    ].
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5505
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5506
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5507
    self setCursorCol: newCursorCol. 
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5508
    self setCursorLine: newCursorLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5509
4970
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  5510
    "Created: / 25-03-2014 / 17:32:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4843
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5511
!
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5512
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5513
handleNonCommandKey:keyArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5514
    |selStartLineBefore selStartColBefore selEndLineBefore selEndColBefore key|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5515
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5516
    self isReadOnly ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5517
        self flashReadOnly.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5518
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5519
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5520
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5521
    key := keyArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5522
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5523
    typeOfSelection == #paste ifTrue:[
4846
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5524
        "Pasted selection will NOT be replaced by keystroke (non-standard, St/X feature)"
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5525
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5526
        "/ After paste, the cursor is at the beginning to support
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5527
        "/ paste-cursordown-paste. Compensate for this here - we want
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5528
        "/ to continue editing after the end of the selection.
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5529
        "/ This is
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5530
        cursorLine := selectionEndLine.
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5531
        cursorCol := selectionEndCol + 1.
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5532
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5533
        "/ Cursor position set, we can unselect.
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5534
        self unselect.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5535
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5536
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5537
    selStartLineBefore := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5538
    selStartColBefore := self selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5539
    selEndLineBefore := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5540
    selEndColBefore := self selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5541
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5542
    (gc characterEncoding ? #'iso10646-1') ~~ #'iso10646-1' ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5543
        key isCharacter ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5544
            key := CharacterEncoder encode:key from:#'iso10646-1' into:gc characterEncoding.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5545
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5546
            key := CharacterEncoder encodeString:key from:#'iso10646-1' into:gc characterEncoding.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5547
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5548
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5549
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5550
    "replace selection by what is typed in -
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5551
     if word was selected with a space, keep it.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5552
     if there was no selection, the key's character is inserted"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5553
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5554
    editMode value isInsertAndSelectMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5555
        selectionStartLine := selectionStartCol := selectionEndLine := selectionEndCol := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5556
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5557
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5558
    (selectStyle == #wordLeft) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5559
        self replaceSelectionBy:(' ' , key asString)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5560
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5561
        (selectStyle == #wordRight) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5562
            self replaceSelectionBy:(key asString , ' ').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5563
            self cursorLeft
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5564
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5565
            self replaceSelectionBy:key
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5566
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5567
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5568
    selectStyle := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5569
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5570
    editMode value isInsertAndSelectMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5571
        selectionStartLine := selStartLineBefore.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5572
        selectionStartCol := selStartColBefore.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5573
        selectionEndLine := selEndLineBefore.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5574
        selectionEndCol := selEndColBefore.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5575
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5576
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5577
    showMatchingParenthesis ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5578
        "emacs style parenthesis shower"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5579
      (ExecutingMacroQuery query ? false) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5580
        "claus: only do it for closing parenthesis -
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5581
                otherwise its too anoying.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5582
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5583
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5584
        ('()[]{}' includes:key) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5585
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5586
        (')]}' includes:key) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5587
        self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5588
            searchForMatchingParenthesisFromLine:cursorLine col:(cursorCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5589
            ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5590
                         |savLine savCol sensor|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5591
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5592
                         self withCursor:Cursor eye do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5593
                             savLine := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5594
                             savCol := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5595
                             self cursorLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5596
                             self flush.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5597
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5598
                             "/ want to wait 200ms, but not if another keyPress
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5599
                             "/ arrives in the meantime ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5600
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5601
                             sensor := self sensor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5602
                             5 timesRepeat:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5603
                                 (sensor hasKeyPressEventFor:self) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5604
                                     Processor activeProcess millisecondDelay:40.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5605
                                 ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5606
                             ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5607
                             self cursorLine:savLine col:savCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5608
                         ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5609
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5610
            ifNotFound:[self showNotFound]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5611
            onError:[self beep]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5612
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5613
      ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5614
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5615
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5616
"/    true "autoExpandWhileTyping" ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5617
"/        self wordAtLine:cursorLine col:cursorCol-1 do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5618
"/            :beginLine :beginCol :endLine :endCol :style |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5619
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5620
"/            self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5621
"/            self selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5622
"/            typeOfSelection := #paste.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5623
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5624
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5625
    editMode value isInsertAndSelectMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5626
        selectionStartLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5627
            self selectFromLine:cursorLine col:cursorCol-1 toLine:cursorLine col:cursorCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5628
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5629
            self selectFromLine:selectionStartLine col:selectionStartCol toLine:cursorLine col:cursorCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5630
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5631
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5632
    completionSupport notNil ifTrue:[ completionSupport postKeyPress:keyArg ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5633
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5634
    "Modified (comment): / 25-01-2012 / 00:30:11 / cg"
4846
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5635
    "Modified: / 30-08-2013 / 20:10:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5636
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5637
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5638
keyPress:key x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5639
    "handle keyboard input"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5640
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5641
    |wasOn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5642
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5643
    wasOn := cursorShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5644
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5645
    NoModificationError handle:[:ex |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5646
        self flashReadOnly.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5647
        (cursorShown not and:[wasOn]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5648
            self makeCursorVisibleAndShowCursor:wasOn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5649
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5650
    ] do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5651
        self undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5652
            self doKeyPress:key x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5653
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5654
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5655
    self repairDamage
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5656
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5657
    "Modified: / 18-04-2011 / 21:35:27 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5658
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5659
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5660
mapped
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5661
    "view was made visible"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5662
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5663
    super mapped.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5664
    self updateCursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5665
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5666
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5667
requestAutoAccept
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5668
    "this is invoked when a dialog closes via accept or cancel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5669
     This forces my value to be accepted into my model"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5670
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5671
    acceptEnabled == false ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5672
        "/ nope -
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5673
        ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5674
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5675
    self accept.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5676
    ^ true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5677
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5678
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5679
sizeChanged:how
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5680
    "make certain, cursor is visible after the sizechange"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5681
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5682
    |cv|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5683
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5684
    cv := cursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5685
    super sizeChanged:how.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5686
    cv notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5687
        self makeLineVisible:cursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5688
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5689
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5690
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5691
unmapped
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5692
    super unmapped.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5693
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5694
    completionSupport notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5695
        completionSupport release.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5696
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5697
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5698
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5699
!EditTextView methodsFor:'focus handling'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5700
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5701
focusOut
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5702
    super focusOut.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5703
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5704
    completionSupport notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5705
        completionSupport release.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5706
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5707
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5708
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5709
hasKeyboardFocus:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5710
    "sent by the windowGroup, a delegate or myself to make me show a block cursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5711
     (otherwise, I would not know about this)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5712
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5713
    hasKeyboardFocus := aBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5714
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5715
    (cursorShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5716
    and:[self enabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5717
    and:[self isReadOnly not]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5718
        self drawCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5719
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5720
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5721
    hasKeyboardFocus ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5722
        completionSupport notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5723
            "/ this is a hack for Windows:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5724
            "/ on windows, an activate:false event is first sent to my textView,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5725
            "/ then an activate is sent to the completion popup.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5726
            "/ this is done BEFORE the buttonPress event is delivered.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5727
            "/ therefore, allow for the activate of the completionMenu and it's button event to be processed.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5728
            "/ before forcing it to be closed...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5729
            Processor addTimedBlock:[completionSupport "release" editViewLostFocus] afterMilliseconds:200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5730
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5731
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5732
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5733
    "Modified (format): / 06-11-2013 / 15:37:31 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5734
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5735
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5736
showFocus:explicit
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5737
    "in addition to however my superclass thinks how a focusView is to be
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5738
     displayed, show the cursor when I got the focus"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5739
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5740
    self showCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5741
    self hasKeyboardFocus:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5742
    super showFocus:explicit
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5743
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5744
    "Modified: 11.12.1996 / 16:56:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5745
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5746
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5747
showNoFocus:explicit
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5748
    "the view lost the keyboard focus 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5749
     (either explicit, via tabbing; or implicit, by pointer movement)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5750
      - change any display attributes as req'd."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5751
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5752
    super showNoFocus:explicit.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5753
    completionSupport notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5754
        completionSupport release.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5755
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5756
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5757
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5758
wantsFocusWithPointerEnter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5759
    "return true, if I want the focus when
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5760
     the mouse pointer enters"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5761
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5762
    (UserPreferences current focusFollowsMouse ~~ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5763
     and:[(styleSheet at:#'editText.requestFocusOnPointerEnter' default:true)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5764
     and:[self enabled
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5765
     and:[true "self isReadOnly not"]]]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5766
    ) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5767
        ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5768
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5769
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5770
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5771
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5772
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5773
!EditTextView methodsFor:'formatting'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5774
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5775
executekeyboardMacroNamed:macroName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5776
    "try to execute the keyboard macro; 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5777
     return true if that worked, false otherwise"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5778
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5779
    |cmdMacro|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5780
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5781
    cmdMacro := UserPreferences current functionKeySequences at:macroName ifAbsent:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5782
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5783
        undoableDo:[ self executeKeyboardMacro:cmdMacro ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5784
        info: macroName.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5785
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5786
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5787
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5788
      EditTextView open
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5789
                contents:'bla';
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5790
                selectAll;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5791
                executekeyboardMacroNamed:#IndentBy4.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5792
      EditTextView open
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5793
                contents:'bla';
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5794
                selectAll;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5795
                executekeyboardMacroNamed:#blabla.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5796
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5797
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5798
    "Modified: / 14-02-2012 / 11:17:27 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5799
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5800
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5801
indent
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5802
    "indent a line-range - this is done by searching for the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5803
     last non-empty line before the selection, and changing the indent
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5804
     of the selected line-range based on that line's indent."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5805
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5806
    |start end|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5807
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5808
    selectionStartLine isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5809
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5810
    start := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5811
    end := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5812
    (selectionEndCol == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5813
        end := end - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5814
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5815
    self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5816
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5817
        undoableDo:[self indentFromLine:start toLine:end]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5818
        info:'Indent'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5819
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5820
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5821
indentBy4
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5822
    self executekeyboardMacroNamed:#IndentBy4.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5823
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5824
    "Modified: / 06-04-2011 / 18:52:40 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5825
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5826
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5827
indentFromLine:start toLine:end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5828
    "indent a line-range - this is done by searching for the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5829
     last non-empty line before start, and change the indent
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5830
     of the selected line-range based on that line's indent."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5831
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5832
    |leftStart delta|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5833
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5834
    leftStart := self leftIndentForLine:start.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5835
    (leftStart == 0) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5836
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5837
    delta := leftStart - (self leftIndentOfLine:start).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5838
    (delta == 0) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5839
    self indentFromLine:start toLine:end by:delta
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5840
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5841
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5842
indentFromLine:start toLine:end by:delta
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5843
    "indent a line-range - this is done by searching for the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5844
     last non-empty line before start, and change the indent
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5845
     of the selected line-range based on that line's indent."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5846
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5847
    |d line spaces anyChange|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5848
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5849
    (delta == 0) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5850
    (delta > 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5851
        spaces := String new:delta
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5852
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5853
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5854
    anyChange := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5855
    start to:end do:[:lineNr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5856
        line := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5857
        line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5858
            line isBlank ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5859
                self basicListAt:lineNr put:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5860
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5861
                (delta > 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5862
                    line := spaces , line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5863
                    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5864
                        widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5865
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5866
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5867
                    "check if deletion is ok"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5868
                    d := delta negated + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5869
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5870
                    line size > d ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5871
                        (line copyTo:(d - 1)) withoutSeparators isEmpty ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5872
                            line := line copyFrom:d
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5873
                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5874
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5875
                    widthOfWidestLine := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5876
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5877
                self replaceLine:lineNr with:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5878
                anyChange := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5879
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5880
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5881
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5882
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5883
    anyChange ifTrue:[ self textChanged ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5884
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5885
    "/ self redrawFromLine:start to:end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5886
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5887
    "Modified: 5.3.1996 / 14:59:18 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5888
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5889
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5890
leftIndentForLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5891
    "find an appropriate indent for a line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5892
     this is done by searching for the last non-empty line before it
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5893
     and returning its indent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5894
     cg: changed: only look for the single previous line."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5895
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5896
    "SHOULD GO TO ListView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5897
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5898
    |line lnr indent|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5899
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5900
    lnr := lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5901
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5902
    "/ [lnr ~~ 1] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5903
    (lnr ~~ 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5904
        lnr  := lnr - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5905
        line := self listAt:lnr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5906
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5907
        line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5908
            indent := line indexOfNonSeparatorStartingAt:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5909
            indent ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5910
                (line endsWith:$[) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5911
                    ^ indent + 4 - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5912
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5913
                ^ indent - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5914
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5915
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5916
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5917
    ^ 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5918
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5919
    "Created: 5.3.1996 / 14:58:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5920
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5921
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5922
undentBy4
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5923
    self executekeyboardMacroNamed:#UndentBy4.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5924
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5925
    "Modified: / 06-04-2011 / 18:52:49 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5926
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5927
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5928
!EditTextView methodsFor:'initialization'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5929
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5930
fetchDeviceResources
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5931
    "fetch device colors, to avoid reallocation at redraw time"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5932
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5933
    super fetchDeviceResources.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5934
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5935
    cursorFgColor notNil ifTrue:[cursorFgColor := cursorFgColor onDevice:self graphicsDevice].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5936
    cursorBgColor notNil ifTrue:[cursorBgColor := cursorBgColor onDevice:self graphicsDevice].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5937
    cursorNoFocusFgColor notNil ifTrue:[cursorNoFocusFgColor := cursorNoFocusFgColor onDevice:self graphicsDevice].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5938
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5939
    "Created: 14.1.1997 / 00:15:24 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5940
    "Modified: 18.2.1997 / 15:02:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5941
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5942
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5943
initEvents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5944
    "enable enter/leave events in addition"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5945
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5946
    super initEvents.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5947
    self enableEnterLeaveEvents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5948
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5949
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5950
initStyle
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5951
    "initialize style specific stuff"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5952
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5953
    super initStyle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5954
    "/ lineSpacing := 2.       "/ for underwave - also looks better
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5955
    lockUpdates := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5956
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5957
    cursorFgColor := DefaultCursorForegroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5958
    cursorFgColor isNil ifTrue:[cursorFgColor := bgColor].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5959
    cursorBgColor := DefaultCursorBackgroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5960
    cursorBgColor isNil ifTrue:[cursorBgColor := fgColor].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5961
    cursorType isNil ifTrue:[cursorType := DefaultCursorType].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5962
    cursorTypeNoFocus isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5963
        cursorTypeNoFocus := cursorType.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5964
        DefaultCursorTypeNoFocus notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5965
            cursorTypeNoFocus := DefaultCursorTypeNoFocus.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5966
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5967
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5968
    cursorNoFocusFgColor := DefaultCursorNoFocusForegroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5969
    cursorNoFocusFgColor isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5970
        cursorType ~~ #block ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5971
            cursorNoFocusFgColor := cursorBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5972
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5973
            cursorNoFocusFgColor := cursorFgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5974
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5975
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5976
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5977
    "Modified: / 15.12.1999 / 22:27:45 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5978
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5979
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5980
initialize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5981
    "initialize a new EditTextView;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5982
     setup some instance variables"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5983
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5984
    super initialize.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5985
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5986
    self level:-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5987
    readOnly := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5988
    fixedSize := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5989
    exceptionBlock := [:errorText | ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5990
    cursorShown := prevCursorState := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5991
    cursorLine := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5992
    cursorVisibleLine := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5993
    cursorCol := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5994
    cursorLineHolder := 1 asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5995
    cursorColHolder := 1 asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5996
    modifiedChannel := ValueHolder with:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5997
    acceptChannel := ValueHolder with:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5998
    acceptChannel addDependent:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5999
    showMatchingParenthesis := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6000
    hasKeyboardFocus := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6001
    tabMeansNextField := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6002
    autoIndent := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6003
    editMode := EditMode insertMode asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6004
    learnMode := false asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6005
    trimBlankLines := self st80EditMode not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6006
    cursorMovementWhenUpdating := #beginOfText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6007
    lastReplacementInfo := LastReplacementInfo new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6008
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6009
    "/ enable drop by default
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6010
    self allowDrop:true.        "/ readOnly tested in #canDrop:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6011
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6012
    undoSupport := UndoSupport for:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6013
    codeAspectHolder := nil asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6014
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6015
    "Modified: / 27-09-2013 / 09:41:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6016
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6017
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6018
initializeCompletionSupport
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6019
    |supportClass|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6020
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6021
    completionSupport isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6022
        (supportClass := self completionSupportClass) notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6023
            completionSupport := supportClass for:self.            
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6024
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6025
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6026
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6027
    "Created: / 26-09-2013 / 17:51:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6028
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6029
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6030
release
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6031
    completionSupport notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6032
        completionSupport release
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6033
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6034
    super release
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6035
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6036
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6037
!EditTextView methodsFor:'macros'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6038
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6039
executeLearnedKeyboardMacro
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6040
    "replay the characters as learned previously"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6041
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6042
    (self learnMode not and:[learnedMacro size > 0]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6043
        ExecutingMacroQuery 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6044
            answer:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6045
            do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6046
                learnedMacro do:[:event |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6047
                            WindowGroup lastEventQuerySignal answer:event
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6048
                            do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6049
                                self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6050
                                    dispatchEvent:event
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6051
                                    withFocusOn:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6052
                                    delegate:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6053
                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6054
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6055
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6056
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6057
        self flash.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6058
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6059
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6060
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6061
learnMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6062
    "true if currently learning"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6063
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6064
    ^ (learnMode value ? false).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6065
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6066
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6067
learnMode:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6068
    "toggle the learn-mode"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6069
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6070
    |fg bg|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6071
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6072
    self learnModeHolder value:aBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6073
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6074
    aBoolean ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6075
        learnedMacro := OrderedCollection new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6076
        fg := Color white.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6077
        bg := Color black.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6078
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6079
        cursorFgColor := fg := (DefaultCursorForegroundColor ? bgColor).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6080
        cursorBgColor := bg := (DefaultCursorBackgroundColor ? fgColor).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6081
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6082
    self cursorForegroundColor:fg backgroundColor:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6083
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6084
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6085
learnModeHolder
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6086
    "a holder returning true, if in learn mode"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6087
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6088
    learnMode isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6089
        learnMode := false asValue
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6090
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6091
    ^ learnMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6092
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6093
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6094
rememberLearnedMacroAs: nameString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6095
    Macros isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6096
        Macros := Dictionary new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6097
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6098
    Macros at:nameString put:learnedMacro
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6099
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6100
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6101
toggleLearnMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6102
    "toggle the learn-mode"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6103
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6104
    self learnMode:(self learnMode not).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6105
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6106
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6107
!EditTextView methodsFor:'menu & menu actions'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6108
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6109
babelFishTranslate:fromToModeString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6110
    "translate the selected text and paste it after the selection"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6111
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6112
    |original translated|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6113
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6114
    original := self selectionAsString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6115
    original size == 0 ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6116
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6117
    self withWaitCursorDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6118
        (HostNameLookupError , SOAP::SoapImplError) handle:[:ex |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6119
            Dialog warn:('Translation failed - WEB Service error:\\%1.' bindWith:ex description allBold) withCRs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6120
        ] do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6121
            translated := SOAP::BabelFishClient new translate:original mode:fromToModeString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6122
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6123
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6124
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6125
    "/ v pasteOrReplace:translated
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6126
    self cursorLine:(self selectionEndLine) col:(self selectionEndCol + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6127
    self unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6128
    self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6129
        undoablePaste:translated 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6130
        info:'Translate'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6131
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6132
    "Modified: / 28-07-2007 / 13:27:21 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6133
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6134
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6135
compareWithClipboard
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6136
    "compare the selection against the clipboard contents"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6137
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6138
    |t1 t2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6139
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6140
    t2 := self getClipboardText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6141
    t2 isEmptyOrNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6142
        Dialog information:'Clipboard is empty.'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6143
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6144
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6145
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6146
    self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6147
        t1 := self selectionAsString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6148
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6149
        t1 := self contents asString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6150
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6151
    t1 := t1 string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6152
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6153
    t1 = t2 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6154
        Dialog information:'Strings are equal.'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6155
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6156
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6157
    DiffTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6158
        openOn:t1 label:'Editor'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6159
        and:t2 label:'Clipboard'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6160
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6161
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6162
cut
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6163
    "cut selection into copybuffer"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6164
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6165
    self deleteCopyToClipboard:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6166
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6167
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6168
defaultForGotoLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6169
    "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
  6170
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6171
    cursorLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6172
        ^ cursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6173
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6174
    ^ super defaultForGotoLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6175
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6176
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6177
deleteCopyToClipboard:toClipboard
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6178
    "cut selection into copybuffer"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6179
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6180
    |line col history sel |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6181
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6182
    (self checkModificationsAllowed) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6183
        self flashReadOnly.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6184
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6185
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6186
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6187
    sel := self selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6188
    sel notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6189
        self setLastStringToReplace: sel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6190
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6191
        line := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6192
        col := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6193
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6194
        toClipboard ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6195
            "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6196
             remember in CopyBuffer
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6197
            "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6198
            self setClipboardText:sel. "/ lastString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6199
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6200
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6201
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6202
         append to DeleteHistory (if there is one)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6203
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6204
        history := Smalltalk at:#DeleteHistory.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6205
        history notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6206
            history addAll:(sel asStringCollection).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6207
            history size > 1000 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6208
                history := history copyFrom:(history size - 1000)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6209
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6210
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6211
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6212
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6213
         now, delete it
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6214
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6215
        self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6216
            undoableDo:[self deleteSelection] 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6217
            info:'Delete'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6218
        lastReplacementInfo lastReplacement: nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6219
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6220
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6221
         a cut without selection will search&cut again
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6222
        "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6223
        self undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6224
            self again
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6225
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6226
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6227
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6228
    "Modified: / 5.4.1998 / 16:51:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6229
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6230
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6231
editMenu
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6232
    "return the views middleButtonMenu"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6233
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6234
    <resource: #keyboard (#Again #AgainForAll #Copy #Cut #Paste #Accept 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6235
                          #Find #GotoLine #SaveAs #Print
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6236
                          #PasteFromHistory #Join #Wrap #Undo #Redo 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6237
                          #ToggleAutoIndent #ToggleInsertMode 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6238
                          #LearnKeyboardMacro #ExecuteKeyboardMacro )>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6239
    <resource: #programMenu>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6240
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6241
    |items m sub translateItems sortItems miscItems toolItems subSub toolSub
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6242
     transSub sortSub what undoIdx redoIdx sensor main mainItems|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6243
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6244
    items := #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6245
                    ('Redo'             redo           Redo        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6246
                    ('Again (for All)'  multipleAgain  AgainForAll )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6247
                    ('-'                                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6248
                    ('Search...'        search         Find     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6249
                    ('Goto Line...'     gotoLine       GotoLine )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6250
                    ('-'                                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6251
                    ('Tools'            tools                   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6252
                    ('Insert Unicode...' insertUnicode )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6253
            ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6254
    CharacterSetView notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6255
        items := items ,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6256
                    #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6257
                        ('Special Characters...'    specialCharacters  OpenSpecialCharacterWindow )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6258
                    ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6259
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6260
    items := items , #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6261
                    ('-'                                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6262
                    ('Save As...'       save           SaveAs   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6263
                    ('Print'            doPrint        Print    )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6264
                    ('='                                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6265
                    ('Misc'             misc           ShiftCtrl) ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6266
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6267
    miscItems := #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6268
                    ('AutoIndent \c'    autoIndent:                  ToggleAutoIndent )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6269
                    ('InsertMode \c'    insertMode:                  ToggleInsertMode )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6270
                    ('-'                                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6271
                    ('Paste Previous...'   pasteOrReplaceFromHistory PasteFromHistory )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6272
                    ('Join Lines'       joinLines                    Join )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6273
                    ('Wrap Lines...'    wrapLines                    Wrap )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6274
                    ('-'                                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6275
                    ('Learn Macro'      learnMode:                   LearnKeyboardMacro)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6276
                    ('Execute Macro'    executeLearnedKeyboardMacro  ExecuteKeyboardMacro )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6277
                    ('-'                                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6278
                    ('Insert File...'           insertFile          )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6279
                    ('Insert URL Contents...'   insertURL           )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6280
                    ('Insert new UUID'      insertUUID          )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6281
                    ('Insert Date && Time'  insertDateAndTime   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6282
                    ('-'                                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6283
                    ('Insert File as String Literal...' insertFileAsStringLiteral  )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6284
                    ('Paste as String Literal'          pasteAsStringLiteral       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6285
                    ('-'                                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6286
                ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6287
"/    CharacterSetView notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6288
"/        miscItems := miscItems ,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6289
"/                    #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6290
"/                        ('Special Characters...'    specialCharacters  OpenSpecialCharacterWindow )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6291
"/                    ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6292
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6293
    miscItems := miscItems ,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6294
                #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6295
                    ('Font...'                  changeFont              )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6296
"/                    ('Encoding...'      changeEncoding          )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6297
                ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6298
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6299
    translateItems := #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6300
                    ('English -> German'      (babelFishTranslate: 'en_de')   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6301
                    ('English -> French'      (babelFishTranslate: 'en_fr')   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6302
                    ('English -> Italian'     (babelFishTranslate: 'en_it')   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6303
                    ('English -> Spanish'     (babelFishTranslate: 'en_es')   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6304
                    ('English -> Portuguese'  (babelFishTranslate: 'en_pt')   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6305
                    ('-'                                        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6306
                    ('German -> English'      (babelFishTranslate: 'de_en')   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6307
                    ('French -> English'      (babelFishTranslate: 'fr_en')   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6308
                    ('Italian -> English'     (babelFishTranslate: 'it_en')   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6309
                    ('Spanish -> English'     (babelFishTranslate: 'es_en')   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6310
                    ('Portuguese -> English'  (babelFishTranslate: 'pt_en')   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6311
              ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6312
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6313
    sortItems := #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6314
                    ('Lines'                            (sortSelection:ignoreCase: #lines false)        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6315
                    ('Lines by First Word'              (sortSelection:ignoreCase: #linesByFirstWord false)     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6316
                    ('Lines by n''th Word'              (sortSelection:ignoreCase: #linesByNthWord false)       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6317
                    ('Lines by n''th Number'            (sortSelection:ignoreCase: #linesByNthNumber false)     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6318
                    ('Lines by n''th Hex Number'        (sortSelection:ignoreCase: #linesByNthHexNumber false)     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6319
                    ('Words'                            (sortSelection:ignoreCase: #words false)        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6320
                    ('-'                                                      )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6321
                    ('Lines (ignore case)'               (sortSelection:ignoreCase: #lines true)         )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6322
                    ('Lines by First Word (ignore case)' (sortSelection:ignoreCase: #linesByFirstWord true)      )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6323
                    ('Lines by n''th Word (ignore case)' (sortSelection:ignoreCase: #linesByNthWord true)        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6324
                    ('Words (ignore case)'               (sortSelection:ignoreCase: #words true)         )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6325
                    ('-'                                                      )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6326
                    ('By Line Length'                    (sortSelection:ignoreCase: #linesByLength nil)         )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6327
                    ('Reverse'                           (sortSelection:ignoreCase: #reverse       nil)         )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6328
              ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6329
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6330
    toolItems := #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6331
                    ('Indent'                      indent                     )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6332
                    ('Toggle Case'      convertSelectionToLowercaseOrUppercaseOrUppercaseFirst   ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6333
                    ('Sort'                        sort                       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6334
                    ('-'                                                      )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6335
                    ('Google Spell Check'          googleSpellingSuggestion   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6336
                    ('Builtin Spell Check'         internalSpellingSuggestion   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6337
                    ('Translate'                   babelFishTranslate         )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6338
                    ('Compare with Clipboard...'   compareWithClipboard       )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6339
              ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6340
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6341
    Smalltalk isStandAloneApp ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6342
        toolItems := toolItems , #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6343
                        ('-'                                                      )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6344
                        ('Open FileBrowser on It'      openFileBrowserOnIt        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6345
                        ('Open Workspace with It'      openWorkspaceWithIt        )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6346
                  ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6347
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6348
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6349
    sub := PopUpMenu itemList:items resources:resources performer:model.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6350
    sub receiver:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6351
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6352
    toolSub := PopUpMenu itemList:toolItems resources:resources performer:model.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6353
    toolSub receiver:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6354
    sub subMenuAt:#tools put:toolSub.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6355
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6356
    transSub := PopUpMenu itemList:translateItems resources:resources performer:model.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6357
    transSub receiver:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6358
    toolSub subMenuAt:#babelFishTranslate put:transSub.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6359
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6360
    sortSub := PopUpMenu itemList:sortItems resources:resources performer:model.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6361
    sortSub receiver:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6362
    toolSub subMenuAt:#sort put:sortSub.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6363
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6364
    subSub := PopUpMenu itemList:miscItems resources:resources performer:model.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6365
    subSub receiver:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6366
    subSub checkToggleAt:#autoIndent: put:autoIndent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6367
    subSub checkToggleAt:#insertMode: put:(self isInInsertMode).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6368
    subSub checkToggleAt:#learnMode: put:(self learnModeHolder value).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6369
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6370
    sub subMenuAt:#misc put:subSub.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6371
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6372
    mainItems := #(
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6373
                    ('Undo'    undo             Undo   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6374
                    ('Again'   again            Again  )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6375
                    ('-'                               )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6376
                    ('Cut'     cut              Cut    )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6377
                    ('Copy'    copySelection    Copy   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6378
                    ('Paste'   pasteOrReplace   Paste  )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6379
                    ('-'                               )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6380
                    ('Accept'  accept           Accept )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6381
                    ('='                               )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6382
                    ('More'    others           Ctrl   )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6383
              ).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6384
    main := PopUpMenu itemList:mainItems resources:resources.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6385
    main subMenuAt:#others put:sub.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6386
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6387
    sensor := self sensor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6388
    (sensor notNil and:[sensor ctrlDown]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6389
       sensor shiftDown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6390
            m := subSub
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6391
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6392
            m := sub
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6393
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6394
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6395
        m := main
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6396
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6397
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6398
    "/ the 'Smalltalk at:' code is here to
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6399
    "/ avoid making the SOAP package a prerequisite for this package (libwidg)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6400
    (Smalltalk at:#'SOAP::GoogleClient') isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6401
        "/ GoogleClient new spellingSuggestionOf: 'Smmalltlaak and Soaap'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6402
        m disable:#googleSpellingSuggestion
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6403
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6404
    (Smalltalk at:#'RBSpellChecker') isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6405
        m disable:#internalSpellingSuggestion
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6406
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6407
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6408
    HTTPInterface isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6409
        m disableAll:#(insertURL)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6410
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6411
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6412
    self isReadOnly ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6413
        m disableAll:#(accept undo again multipleAgain redo
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6414
                       paste pasteOrReplace pasteOrReplaceFromHistory
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6415
                       cut indent autoIndent: insertMode:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6416
                       insertFile insertFileAsStringLiteral insertURL
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6417
                       babelFishTranslate googleSpellingSuggestion sort
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6418
                       convertSelectionToLowercaseOrUppercaseOrUppercaseFirst 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6419
                       joinLines wrapLines insertUUID insertDateAndTime pasteAsStringLiteral
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6420
                       insertUnicode specialCharacters)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6421
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6422
    self hasSelectionForCopy ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6423
        m disable:#copySelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6424
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6425
    self hasSelection ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6426
        m disableAll:#(cut googleSpellingSuggestion babelFishTranslate openFileBrowserOnIt openWorkspaceWithIt sort indent).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6427
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6428
        (Error handle:[:ex |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6429
            ex return:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6430
        ] do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6431
            |fn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6432
            fn := self selectionAsString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6433
            fn asFilename exists or:[ fn withoutSeparators withoutQuotes asFilename exists ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6434
        ]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6435
            m disableAll:#(openFileBrowserOnIt).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6436
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6437
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6438
    self hasUndoAction ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6439
        m disable:#undo.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6440
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6441
        what := undoSupport undoActionInfo.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6442
        what notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6443
            undoIdx := m indexOf:#undo.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6444
            m labelAt:undoIdx put:(resources string:'Undo (%1)' with:what).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6445
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6446
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6447
    self hasRedoAction ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6448
        sub disable:#redo.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6449
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6450
        what := undoSupport redoActionInfo.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6451
        what notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6452
            redoIdx := sub indexOf:#redo.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6453
            sub labelAt:redoIdx put:(resources string:'Redo (%1)' with:what).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6454
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6455
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6456
    acceptEnabled == false ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6457
        m disable:#accept
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6458
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6459
    ^ m.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6460
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6461
    "Modified: / 01-03-2012 / 19:56:58 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6462
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6463
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6464
getTextSelectionFromHistory
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6465
    |sel list box history|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6466
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6467
    history := self graphicsDevice getCopyBufferHistory copy.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6468
    list := history collect:[:entry |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6469
                |text shown|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6470
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6471
                text := entry asString string asCollectionOfLines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6472
                shown := text detect:[:line| line notEmptyOrNil] ifNone:['      '].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6473
                text size > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6474
                    shown := shown,(resources string:' ... [%1 lines]' with:text size).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6475
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6476
                shown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6477
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6478
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6479
    box := ListSelectionBox
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6480
                title:(resources string:'Clipboard History')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6481
                okText:(resources string:'Paste')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6482
                abortText:(resources string:'Cancel')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6483
                list:list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6484
                action:[:idx | idx notNil ifTrue:[sel := history at:idx]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6485
    box label:(resources string:'Select Previous Copybuffer String').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6486
    box useIndex:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6487
    box show.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6488
    ^ sel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6489
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6490
    "Modified: / 25-08-2010 / 22:02:14 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6491
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6492
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6493
getTextSelectionOrTextSelectionFromHistory
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6494
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6495
    self sensor shiftDown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6496
        ^ self getTextSelectionFromHistory
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6497
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6498
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6499
    "/ return either the (xterm-) selection or the clipBoard depending on
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6500
    "/ the Ctrl-Key state.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6501
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6502
    "/ ouch - this used to be ok for ALT-c / ALT-v,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6503
    "/ but no longer works with CTRL-c / CTRL-v.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6504
    ^ self getClipboardText:#clipboard
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6505
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6506
"/    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6507
"/        getClipboardText:(self sensor ctrlDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6508
"/                            ifTrue:[#selection]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6509
"/                            ifFalse:[#clipboard])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6510
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6511
    "Modified: / 13-07-2011 / 14:55:58 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6512
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6513
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6514
googleSpellingSuggestion
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6515
    "insert the google-spelling suggestion for the selected text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6516
     Requires that the SOAP stuff is loaded and working."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6517
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6518
    |text suggestion|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6519
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6520
    self withWaitCursorDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6521
        text := self selection asString string withoutSeparators.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6522
        text size == 0 ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6523
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6524
        "/ the 'Smalltalk at:' code is here to
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6525
        "/ avoid making the SOAP package a prerequisite for this package (libwidg)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6526
        (Smalltalk at:#'SOAP::SoapImplError') handle:[:ex |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6527
            Dialog warn:('Spelling correction failed - WEB Service error:\\%1.' bindWith:ex description allBold) withCRs.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6528
            ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6529
        ] do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6530
            suggestion := (Smalltalk at:#'SOAP::GoogleClient') new spellingSuggestionOf:text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6531
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6532
        suggestion size == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6533
            self information:('No spelling suggestion from Google for: ' , text).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6534
            Transcript showCR:('No spelling suggestion from Google for: ' , text).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6535
            ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6536
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6537
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6538
    self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6539
        undoablePaste:suggestion 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6540
        info:'Spelling Suggestion'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6541
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6542
    "Modified: / 28-07-2007 / 13:25:10 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6543
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6544
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6545
insertDateAndTime
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6546
    "insert the curent date and time string"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6547
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6548
    typeOfSelection := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6549
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6550
        undoableDo:[ self pasteOrReplace:(Timestamp now printStringRFC1123Format)]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6551
        info:'Paste Date and Time'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6552
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6553
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6554
insertFile
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6555
    "insert contents of a file
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6556
     - ask user for filename using a fileSelectionBox."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6557
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6558
    self insertFileAsStringLiteral:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6559
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6560
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6561
insertFileAsStringLiteral
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6562
    "insert a file's contents as a string literal.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6563
     Almost the same as the insert file, but single-quotes are doubled,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6564
     to make it a legal string literal"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6565
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6566
    self insertFileAsStringLiteral:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6567
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6568
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6569
insertFileAsStringLiteral:asStringLiteral
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6570
    "insert contents of a file; either as-is or as a string literal.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6571
     - ask user for filename using a fileSelectionBox."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6572
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6573
    |sel selFn file text ok initial|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6574
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6575
    ((sel := self selectionAsString) notEmptyOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6576
    and:[ (selFn := sel asFilename) exists
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6577
    and:[ selFn isRegularFile ]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6578
    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6579
        initial := selFn pathName.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6580
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6581
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6582
    [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6583
        |why|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6584
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6585
        file := Dialog
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6586
            requestFileName:(resources string:'Insert Contents Of:')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6587
            default:initial
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6588
            ok:(resources string:'Insert')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6589
            abort:(resources string:'Cancel')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6590
            pattern:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6591
            fromDirectory:directoryForFileDialog.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6592
        file isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6593
            "cancel"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6594
            ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6595
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6596
        file := file asFilename.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6597
        directoryForFileDialog := file.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6598
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6599
        ok := file isReadable and:[file isDirectory not].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6600
        ok ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6601
            file isReadable ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6602
                why := '%1 is unreadable.\\Please try again.'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6603
            ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6604
                why := '%1 is a directory.\\Please try again.'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6605
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6606
            Dialog warn:(resources stringWithCRs:why with:file pathName).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6607
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6608
    ] doUntil:[ok].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6609
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6610
    text := file contentsOfEntireFile.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6611
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6612
        undoableDo:[ self paste:(asStringLiteral ifTrue:[text storeString] ifFalse:[text]) ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6613
        info:'Paste File'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6614
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6615
    "Modified: / 28-07-2007 / 13:23:32 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6616
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6617
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6618
insertURL
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6619
    "insert contents of a URL
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6620
     - ask user for URL using a dialog."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6621
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6622
    self insertURLAsStringLiteral:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6623
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6624
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6625
insertURLAsStringLiteral:asStringLiteral
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6626
    "insert contents of a file; either as-is or as a string literal.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6627
     - ask user for filename using a fileSelectionBox."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6628
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6629
    |sel url text response initial|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6630
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6631
    (sel := self selectionAsString) notEmptyOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6632
    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6633
        initial := sel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6634
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6635
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6636
    url := Dialog
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6637
        request:(resources string:'Insert Contents of URL:')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6638
        initialAnswer:initial
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6639
        okLabel:(resources string:'Insert')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6640
        title:(resources string:'URL').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6641
    url isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6642
        "cancel"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6643
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6644
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6645
    response := HTTPInterface get:url.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6646
    response isErrorResponse ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6647
        Dialog warn:(resources string:'Could not fetch the document: %1' with:url).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6648
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6649
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6650
    text := response data asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6651
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6652
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6653
        undoableDo:[ 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6654
            self paste:(asStringLiteral ifTrue:[text storeString] ifFalse:[text]) 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6655
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6656
        info:'Insert Contents of URL'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6657
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6658
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6659
insertUUID
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6660
    "insert a new UUID's string"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6661
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6662
    typeOfSelection := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6663
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6664
        undoableDo:[ self pasteOrReplace:(UUID genUUID printString)]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6665
        info:'Paste New UUID'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6666
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6667
    "Created: / 28-07-2007 / 13:01:16 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6668
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6669
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6670
insertUnicode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6671
    "open a Dialog requesting an integer value and insert it as unicode character"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6672
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6673
    |unicodePoint unicodeChar unicodeString|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6674
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6675
    unicodeString := Dialog request:'Enter unicode (U+01FF or decimal number):'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6676
    unicodeString size < 2 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6677
        ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6678
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6679
    (unicodeString second = $+ and:['Uu' includes:unicodeString first]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6680
        unicodePoint := Integer readFrom:(unicodeString copyFrom:3) radix:16 onError:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6681
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6682
        unicodePoint := Integer readFrom:unicodeString onError:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6683
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6684
        
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6685
    unicodeChar := Character value:unicodePoint.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6686
    self keyPress:unicodeChar x:0 y:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6687
    self keyRelease:unicodeChar x:0 y:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6688
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6689
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6690
internalSpellingSuggestion
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6691
    "insert the internal-spelling suggestion for the selected text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6692
     Requires that the RefactoryBrowser/line/spelCheck stuff is loaded."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6693
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6694
    |text suggestions best|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6695
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6696
    self withWaitCursorDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6697
        text := self selection asString string withoutSeparators.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6698
        text size == 0 ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6699
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6700
        suggestions := RBSpellChecker default bestMatchesFor:text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6701
        suggestions size == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6702
            self information:('No spelling suggestion from builtin checker for: ' , text).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6703
            Transcript showCR:('No spelling suggestion from builtin checker for: ' , text).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6704
            ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6705
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6706
        Transcript showCR:suggestions.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6707
        best := suggestions first.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6708
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6709
    self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6710
        undoablePaste:best 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6711
        info:'Spelling Suggestion'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6712
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6713
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6714
openFileBrowserOnFileNamed:fileNameString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6715
    "open a fileBrowser on the given fileNameString"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6716
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6717
    |fn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6718
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6719
    fn := fileNameString asFilename.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6720
    fn exists ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6721
        fn := fileNameString withoutSeparators withoutQuotes asFilename.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6722
        fn exists ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6723
            ^ self warn:'Oops - file is gone'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6724
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6725
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6726
    UserPreferences fileBrowserClass openOn:fn
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6727
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6728
    "Modified: / 06-09-2012 / 14:47:22 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6729
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6730
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6731
openFileBrowserOnIt
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6732
    "open a fileBrowser on the selected fileName"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6733
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6734
    |fileNameString|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6735
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6736
    fileNameString := self selectionAsString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6737
    self openFileBrowserOnFileNamed:fileNameString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6738
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6739
    "Modified: / 06-09-2012 / 14:47:22 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6740
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6741
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6742
openWorkspaceWithIt
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6743
    "open a workspace containing the selected text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6744
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6745
    |text|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6746
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6747
    text := self selectionAsString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6748
    WorkspaceApplication openWith:text selected:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6749
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6750
    "Created: / 26-05-2007 / 06:05:22 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6751
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6752
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6753
paste
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6754
    "paste the copybuffer; if there is a selection, unselect first.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6755
     Then paste at cursor position."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6756
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6757
    self checkModificationsAllowed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6758
        self withSelfAndTextForPasteDo:[:me :text |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6759
            me unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6760
            me undoablePaste:text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6761
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6762
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6763
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6764
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6765
paste:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6766
    "paste someText at cursor"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6767
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6768
    self paste:someText withCR:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6769
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6770
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6771
paste:someText withCR:withCR
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6772
    "paste someText at cursor"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6773
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6774
    |s nLines startLine startCol l1 l2 c1 c2 codingErrorReported|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6775
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6776
    self checkModificationsAllowed ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6777
    someText isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6778
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6779
    s := someText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6780
    codingErrorReported := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6781
    CharacterEncoderError handle:[:ex |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6782
        |code msg|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6783
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6784
        code := ex parameter.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6785
        codingErrorReported ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6786
            msg := 'Cannot represent pasted string in this Views encoding (',gc characterEncoding,').'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6787
            code notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6788
                msg := msg , '\\Reason: No representation for ' , (code radixPrintStringRadix:16).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6789
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6790
            Dialog warn:(resources stringWithCRs:msg).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6791
            codingErrorReported := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6792
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6793
        ex proceedWith:ex defaultValue
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6794
    ] do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6795
        s isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6796
            s encoding ~~ gc characterEncoding ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6797
                s := s encodeFrom:(s encoding) into:gc characterEncoding.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6798
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6799
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6800
            s := s asStringCollection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6801
            (someText endsWith:Character cr) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6802
                "/ s := s copyWith:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6803
                s := s copyWith:'' "/ an empty line at the end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6804
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6805
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6806
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6807
            s isStringCollection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6808
                s := s encodeFrom:(s encoding) into:gc characterEncoding.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6809
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6810
                (self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6811
                    confirm:(resources
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6812
                        stringWithCRs:'Selection (%1) is not convertable to Text.\\Paste storeString ?'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6813
                        with:s class name)) ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6814
                s := StringCollection with:s storeString .
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6815
                "/ ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6816
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6817
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6818
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6819
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6820
    (nLines := s size) == 0 ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6821
    (nLines == 1 and:[(s at:1) size == 0]) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6822
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6823
    typeOfSelection := #paste.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6824
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6825
    startLine := l1 := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6826
    startCol := c1 := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6827
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6828
    "do not expand tabs into spaces here -
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6829
     they get expanded in basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6830
     Some Subviews want to paste with unexpanded tabs!!"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6831
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6832
    self insertLines:s withCR:withCR.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6833
    l2 := cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6834
    c2 := (cursorCol - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6835
    self selectFromLine:l1 col:c1 toLine:l2 col:c2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6836
    typeOfSelection := #paste. "/ sigh - cleared by #selectFromLine:
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6837
    "/ For Claus to support paste-cursordown-paste :-)
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6838
    "/ Move cursor the the beggining of the selection so subsequent
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6839
    "/ cursor move will start there.
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6840
    self setCursorLine: l1.
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6841
    self setCursorCol: c1.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6842
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6843
    "Modified: / 14-02-1996 / 11:14:14 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6844
    "Modified: / 25-01-2012 / 00:31:30 / cg"
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6845
    "Modified: / 30-08-2013 / 00:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6846
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6847
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6848
pasteAsStringLiteral
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6849
    "insert clipboard string as a string literal.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6850
     Almost the same as a normal paste, but single-quotes are doubled,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6851
     to make it a legal string literal"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6852
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6853
    typeOfSelection := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6854
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6855
        undoableDo:[ self pasteOrReplace:(self getClipboardText storeString) ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6856
        info:'Paste as String Literal'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6857
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6858
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6859
pasteOrReplace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6860
    "paste the copybuffer; if there is a selection, replace it.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6861
     otherwise paste at cursor position.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6862
     Replace is not done for selections which were created by a paste,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6863
     to allow multiple paste operations in a row."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6864
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6865
    self withSelfAndTextForPasteDo:[:me :text | me pasteOrReplace:text]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6866
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6867
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6868
pasteOrReplace:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6869
    "paste someText; if there is a selection, replace it.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6870
     otherwise paste at cursor position. Replace is not done
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6871
     for originating by a paste, to allow multiple
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6872
     paste."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6873
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6874
    self checkModificationsAllowed ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6875
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6876
    self undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6877
        ((self hasSelection == true) and:[typeOfSelection ~~ #paste]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6878
            self replace:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6879
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6880
            self paste:someText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6881
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6882
    ] info:'Paste/Replace'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6883
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6884
    "Modified: / 30.1.2000 / 02:33:00 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6885
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6886
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6887
pasteOrReplaceFromHistory
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6888
    "paste a previous item from the copybuffer history.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6889
     (i.e. repaste some previously deleted or copied text)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6890
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6891
    |text|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6892
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6893
    self checkModificationsAllowed ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6894
        self flashReadOnly.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6895
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6896
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6897
    text := self getTextSelectionFromHistory.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6898
    text notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6899
        self pasteOrReplace:text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6900
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6901
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6902
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6903
replace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6904
    "replace the selection by the contents of the copybuffer"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6905
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6906
    self hasSelection ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6907
    self checkModificationsAllowed ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6908
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6909
    self withSelfAndTextForPasteDo:[:me :text |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6910
        me undoableDo:[ me replace:text ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6911
        info:'Replace'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6912
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6913
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6914
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6915
replace:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6916
    "replace the selection by someText"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6917
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6918
    |selected selectedString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6919
     selStartLine selStartCol selEndLine selEndCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6920
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6921
    self checkModificationsAllowed ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6922
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6923
    self undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6924
        selected := self selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6925
        selected isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6926
            ^ self paste:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6927
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6928
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6929
        self deleteSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6930
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6931
        "take care, if we replace a selection without space by a word selected
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6932
         with one - in this case we usually do not want the space.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6933
         But, if we replace a word-selected selection by something without a
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6934
         space, we DO want the space added."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6935
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6936
        selected size == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6937
            selectedString := selected at:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6938
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6939
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6940
        someText size == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6941
            |cutOffSpace addSpace replacement replacementString|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6942
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6943
            cutOffSpace := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6944
            addSpace := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6945
            replacement := someText copyFrom:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6946
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6947
            selectedString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6948
                ((selectedString startsWith:' ') or:[selectedString endsWith:' ']) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6949
                   "selection has no space"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6950
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6951
                    ((selectStyle == #wordleft) or:[selectStyle == #wordRight]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6952
                        cutOffSpace := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6953
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6954
                ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6955
                    addSpace := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6956
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6957
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6958
            replacementString := replacement at:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6959
            cutOffSpace ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6960
                (replacementString startsWith:' ') ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6961
                    replacementString := replacementString withoutSpaces
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6962
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6963
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6964
                selectStyle == #wordLeft ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6965
                    "want a space at left"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6966
                    (replacementString startsWith:' ') ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6967
                        replacementString := replacementString withoutSpaces.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6968
                        replacementString := ' ' , replacementString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6969
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6970
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6971
                selectStyle == #wordRight ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6972
                    "want a space at right"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6973
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6974
                    (replacementString endsWith:' ') ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6975
                        replacementString := replacementString withoutSpaces.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6976
                        replacementString := replacementString , ' '
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6977
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6978
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6979
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6980
            replacement at:1 put: replacementString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6981
            self paste:replacement.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6982
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6983
            self paste:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6984
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6985
        self setLastStringToReplace: selectedString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6986
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6987
        lastReplacementInfo lastReplacement: someText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6988
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6989
        selStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6990
        selStartCol := self selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6991
        selEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6992
        selEndCol := self selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6993
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6994
    info:'Replace'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6995
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6996
    "Modified: / 14.2.1996 / 10:37:02 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6997
    "Modified: / 5.4.1998 / 16:55:28 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6998
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  6999
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7000
searchReplace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7001
    "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
  7002
     replace for the found searchpattern or replace all searchpattern found to a new pattern - show  a box to enter replacepattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7003
     - currently no regular expressions are handled."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7004
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7005
    |searchBox patternHolder replacePatternHolder caseHolder flag ign initialString bindings bldr search modal replace action|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7006
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7007
    modal := false "(UserPreferences current searchDialogIsModal)".
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7008
    lastSearchDirection := #forward.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7009
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7010
    caseHolder := ign asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7011
    patternHolder := '' asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7012
    replacePatternHolder := '' asValue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7013
    lastSearchPattern notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7014
        initialString := lastSearchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7015
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7016
    self hasSelectionWithinSingleLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7017
        initialString := self selectionAsString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7018
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7019
    initialString isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7020
        LastSearchPatterns size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7021
            initialString := LastSearchPatterns first
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7022
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7023
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7024
    initialString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7025
        patternHolder value:initialString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7026
        replacePatternHolder value:initialString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7027
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7028
    flag := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7029
    search := [:fwd |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7030
            self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7031
                search:patternHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7032
                ignoreCase:caseHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7033
                forward:fwd.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7034
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7035
    replace := [:all |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7036
            self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7037
                replace:patternHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7038
                by:replacePatternHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7039
                all:all
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7040
                ignoreCase:caseHolder value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7041
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7042
    bindings := IdentityDictionary new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7043
    bindings at:#searchPattern put:patternHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7044
    bindings at:#replacePattern put:replacePatternHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7045
    modal ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7046
        bindings at:#nextAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7047
            put:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7048
                flag := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7049
                action := search.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7050
                searchBox doAccept.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7051
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7052
        bindings at:#prevAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7053
            put:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7054
                flag := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7055
                action := search.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7056
                searchBox doAccept.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7057
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7058
        bindings at:#replaceAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7059
            put:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7060
                flag := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7061
                action := replace.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7062
                searchBox doAccept.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7063
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7064
        bindings at:#replaceAllAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7065
            put:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7066
                flag := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7067
                action := replace.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7068
                searchBox doAccept.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7069
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7070
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7071
        bindings at:#nextAction put:[ search value:true. ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7072
        bindings at:#prevAction put:[ search value:false. ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7073
        bindings at:#replaceAction put:[ replace value:false. ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7074
        bindings at:#replaceAllAction put:[ replace value:true. ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7075
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7076
    bindings at:#ignoreCase put:caseHolder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7077
    bindings at:#patternList put:LastSearchPatterns.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7078
    modal ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7079
        searchBox := SimpleDialog new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7080
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7081
        searchBox := ApplicationModel new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7082
        searchBox createBuilder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7083
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7084
    searchBox resources:(self resources).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7085
    bldr := searchBox builder.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7086
    bldr addBindings:bindings.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7087
    searchBox allButOpenFrom:(self class searchReplaceDialogSpec).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7088
    (bldr componentAt:#nextButton) cursor:(Cursor thumbsUp).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7089
    (bldr componentAt:#prevButton) cursor:(Cursor thumbsUp).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7090
    (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7091
    modal ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7092
        searchBox openDialog.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7093
        searchBox accepted ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7094
            action value:flag
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7095
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7096
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7097
        (bldr componentAt:#nextButton) isReturnButton:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7098
        (bldr componentAt:#cancelButton)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7099
            label:(resources string:'Close');
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7100
            action:[ searchBox closeRequest ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7101
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7102
        "/ searchBox masterApplication:self application.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7103
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7104
        self topView beMaster.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7105
        (searchBox window)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7106
            beSlave;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7107
            openInGroup:(self windowGroup).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7108
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7109
        "/ searchBox window open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7110
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7111
        searchBox window assignKeyboardFocusToFirstInputField.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7112
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7113
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7114
    "Modified: / 11-07-2006 / 11:20:06 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7115
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7116
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7117
showDeleted
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7118
    "open a readonly editor on all deleted text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7119
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7120
    |v|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7121
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7122
    v := EditTextView openWith:(Smalltalk at:#DeleteHistory).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7123
    v readOnly:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7124
    v topView label:'deleted text'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7125
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7126
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7127
sort:how ignoreCase:ignoreCase fromLine:start toLine:end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7128
    "sort/reorder the selected lines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7129
     how:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7130
        #lines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7131
        #linesByFirstWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7132
        #linesByNthWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7133
        #linesByNthNumber
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7134
        #linesByNthHexNumber
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7135
        #words
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7136
        #linesByLength
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7137
        #reverse
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7138
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7139
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7140
    |lines extractor innerExtractor fetcher operation lineWise nStr n s words|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7141
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7142
    lineWise := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7143
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7144
    how == #reverse ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7145
        operation := [:lines | lines reverse].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7146
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7147
        operation := [:linesOrWords |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7148
                        linesOrWords sort:[:item1 :item2 | (fetcher value:item1) < (fetcher value:item2)]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7149
                     ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7150
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7151
        how == #linesByLength ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7152
            fetcher := [:l | l size].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7153
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7154
            how == #lines ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7155
                extractor := [:l | l withoutLeadingSeparators].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7156
            ] ifFalse:[ 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7157
                how == #linesByFirstWord ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7158
                    extractor := [:l | ((l asCollectionOfWords select:[:w | w isEmpty or:[w first isLetterOrDigit]]) at:1 ifAbsent:'')].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7159
                ] ifFalse:[ 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7160
                    ((how == #linesByNthWord) or:[ how == #linesByNthNumber  or:[ how == #linesByNthHexNumber]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7161
                        nStr := Dialog request:'Word/Column (1..)' initialAnswer:(LastColumnNumberForSort ? 2).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7162
                        nStr isEmptyOrNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7163
                        n := Integer readFrom:nStr onError:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7164
                        LastColumnNumberForSort := n.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7165
                        extractor := [:l | ((l string asCollectionOfWords) at:n ifAbsent:'')].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7166
                        how == #linesByNthNumber ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7167
                            innerExtractor := extractor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7168
                            extractor := [:l | Integer readFrom:(innerExtractor value:l) onError:0]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7169
                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7170
                            how == #linesByNthHexNumber ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7171
                                innerExtractor := extractor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7172
                                extractor := [:l | 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7173
                                    |s|                                 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7174
                                    s := innerExtractor value:l.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7175
                                    (s startsWith:'16r') ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7176
                                        (Integer readSmalltalkSyntaxFrom:s) ? 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7177
                                    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7178
                                        Integer readFrom:s radix:16 onError:[ 0 ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7179
                                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7180
                                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7181
                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7182
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7183
                    ] ifFalse:[ 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7184
                        how == #words ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7185
                            lineWise := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7186
                            extractor := [:w | w].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7187
                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7188
                            self error:'unknown sort criteria: ', how printString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7189
                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7190
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7191
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7192
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7193
            ignoreCase ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7194
                fetcher := [:l | (extractor value:l) asLowercase].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7195
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7196
                fetcher := extractor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7197
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7198
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7199
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7200
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7201
    lineWise ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7202
        "process the lines of the selection (aka a collection of lines)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7203
        start == end ifTrue:[^ self ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7204
        lines := (start to:end) collect:[:lineNr | (self listAt:lineNr) ? ''].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7205
        lines := operation value:lines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7206
        (start to:end) with:lines do:[:lineNr :line | self replaceLine:lineNr with:line].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7207
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7208
        "process the whole selection as a string"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7209
        s := self selectionAsString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7210
        words := s asCollectionOfWords.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7211
        words := operation value:words.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7212
        s := words asStringCollection asStringWith:Character space.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7213
        self replace:s.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7214
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7215
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7216
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7217
    "Modified: / 31-03-2012 / 10:59:28 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7218
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7219
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7220
sortSelection:how ignoreCase:ignoreCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7221
    "sort the selected lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7222
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7223
    |start end|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7224
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7225
    selectionStartLine isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7226
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7227
    start := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7228
    end := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7229
    (selectionEndCol == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7230
        end := end - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7231
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7232
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7233
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7234
        undoableDo:[ 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7235
            self sort:how ignoreCase:ignoreCase fromLine:start toLine:end 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7236
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7237
        info:'Sort'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7238
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7239
    "Modified (format): / 15-02-2012 / 16:52:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7240
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7241
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7242
specialCharacters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7243
    CharacterSetView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7244
        openAsInputFor:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7245
        label:'Special Character Input'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7246
        clickLabel:'Click to Insert Character'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7247
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7248
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7249
undoablePaste:someText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7250
    self undoablePaste:someText info:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7251
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7252
    "Modified: / 28-07-2007 / 13:25:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7253
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7254
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7255
undoablePaste:someText info:infoOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7256
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7257
        undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7258
            self paste:someText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7259
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7260
        info:infoOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7261
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7262
    "Created: / 28-07-2007 / 13:25:30 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7263
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7264
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7265
undoablePasteOrReplace:someText info:infoOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7266
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7267
        undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7268
            self pasteOrReplace:someText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7269
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7270
        info:infoOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7271
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7272
    "Created: / 28-07-2007 / 13:26:16 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7273
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7274
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7275
undoablePasteReplacingAll:someText info:infoOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7276
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7277
        undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7278
            self selectAll.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7279
            self pasteOrReplace:someText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7280
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7281
        info:infoOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7282
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7283
    "Created: / 28-07-2007 / 13:25:30 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7284
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7285
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7286
withSelfAndTextForPasteDo:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7287
    "common code for paste/replace of the copybuffer"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7288
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7289
    |sel|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7290
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7291
    self checkModificationsAllowed ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7292
        self flashReadOnly.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7293
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7294
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7295
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7296
    sel := self getTextSelectionOrTextSelectionFromHistory.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7297
    sel notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7298
        aBlock value:self value:sel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7299
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7300
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7301
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7302
!EditTextView methodsFor:'private'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7303
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7304
beep
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7305
    UserPreferences current beepInEditor ifTrue:[                
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7306
        super beep
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7307
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7308
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7309
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7310
checkModificationsAllowed
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7311
    "check if the text can be modified (i.e. is not readOnly).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7312
     evaluate the exceptionBlock if not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7313
     This block should be provided by the application or user of the textView,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7314
     and may show a warnBox or whatever."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7315
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7316
    self isReadOnly ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7317
        exceptionBlock isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7318
            ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7319
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7320
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7321
        (exceptionBlock value:'Text may not be modified') ~~ true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7322
            ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7323
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7324
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7325
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7326
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7327
    "Modified: / 17.6.1998 / 15:51:10 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7328
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7329
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7330
currentSelectionBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7331
    typeOfSelection == #paste ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7332
        ^ DefaultAlternativeSelectionBackgroundColor ? selectionBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7333
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7334
    ^ super currentSelectionBgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7335
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7336
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7337
     DefaultAlternativeSelectionBackgroundColor := Color yellow blendWith:Color green
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7338
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7339
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7340
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7341
currentSelectionFgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7342
    typeOfSelection == #paste ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7343
        ^ DefaultAlternativeSelectionForegroundColor ? selectionFgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7344
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7345
    ^ super currentSelectionFgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7346
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7347
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7348
resetVariablesBeforeNewSearch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7349
    "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
  7350
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7351
    super resetVariablesBeforeNewSearch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7352
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7353
    "/ new search invalidates remembered string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7354
    lastStringFromReplaceForNextSearch := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7355
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7356
    "Modified (comment): / 07-03-2012 / 23:21:06 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7357
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7358
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7359
setLastStringToReplace: aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7360
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7361
    "This method will set the information coming from the last replace into the replacementInfo"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7362
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7363
    |lastReplaceIgnoredCase|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7364
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7365
    "/ 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
  7366
    self clearSearchAction.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7367
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7368
    lastReplacementInfo lastStringToReplace: aString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7369
    lastStringFromReplaceForNextSearch := aString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7370
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7371
    "If the replace came after a search, the next replace will have the ignored case from that search action"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7372
    lastReplaceIgnoredCase := (typeOfSelection == #search) 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7373
                                ifTrue: [lastSearchIgnoredCase] 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7374
                                ifFalse: [nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7375
    lastReplacementInfo lastReplaceIgnoredCase: lastReplaceIgnoredCase.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7376
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7377
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7378
st80EditMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7379
    ^ st80Mode ? (UserPreferences current st80EditMode)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7380
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7381
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7382
suppressEmphasisInSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7383
    "selection is shown without emphasis"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7384
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7385
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7386
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7387
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7388
textChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7389
    "my text was modified (internally).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7390
     Sent whenever text has been edited (not to confuse with
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7391
     contentsChanged, which is triggered when the size has changed, and
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7392
     is used to notify scrollers, other views etc.).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7393
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7394
     As some authors of this code have been very sloppy in tha past 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7395
     (not sending contentsChanged, but textChanged),
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7396
     we do it here despite what is written above, to ensure that scrollers update correctly."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7397
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7398
    self contentsChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7399
    self modified:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7400
    contentsWasSaved := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7401
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7402
    "Modified: 14.2.1997 / 16:58:38 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7403
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7404
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7405
textChangedButNoSizeChange
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7406
    "my text was modified (internally).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7407
     Sent whenever text has been edited (not to confuse with
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7408
     contentsChanged, which is triggered when the size has changed, and
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7409
     is used to notify scrollers, other views etc.)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7410
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7411
    self modified:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7412
    contentsWasSaved := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7413
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7414
    "Modified: 14.2.1997 / 16:58:38 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7415
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7416
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7417
!EditTextView methodsFor:'queries'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7418
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7419
currentLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7420
    "the current line (for relative gotos)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7421
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7422
    ^ cursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7423
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7424
    "Created: / 17.5.1998 / 20:07:52 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7425
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7426
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7427
hasSearchActionSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7428
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7429
    ^ typeOfSelection == #searchAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7430
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7431
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7432
isKeyboardConsumer
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7433
    "return true, if the receiver is a keyboard consumer;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7434
     Return true here, redefined from SimpleView."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7435
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7436
    ^ self isReadOnly not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7437
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7438
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7439
specClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7440
    "redefined, since the name of my specClass is nonStandard (i.e. not EditTextSpec)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7441
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7442
    self class == EditTextView ifTrue:[^ TextEditorSpec].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7443
    ^ super specClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7444
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7445
    "Modified: / 31.10.1997 / 19:48:19 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7446
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7447
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7448
tabMeansNextField
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7449
    "return true, if a Tab character should shift focus."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7450
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7451
    "if not readOnly, I want my tab keys ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7452
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7453
    ^ self isReadOnly or:[tabMeansNextField]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7454
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7455
    "Created: 7.2.1996 / 19:15:31 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7456
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7457
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7458
widthOfContents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7459
    "return the width of the contents in pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7460
     Redefined to add the size of a space (for the cursor).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7461
     this enables us to scroll one position further than the longest
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7462
     line (and possibly see the cursor behind the line)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7463
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7464
    |w dev|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7465
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7466
    w := super widthOfContents.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7467
    (dev := self graphicsDevice ) isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7468
        "/ really don't know ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7469
        dev := Screen current
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7470
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7471
    ^ w + (gc font widthOn:dev)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7472
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7473
    "Modified: 28.5.1996 / 19:32:25 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7474
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7475
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7476
!EditTextView methodsFor:'realization'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7477
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7478
realize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7479
    "make the view visible - scroll to make the cursor visible."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7480
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7481
    super realize.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7482
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7483
    self makeCursorVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7484
    cursorFgColor := cursorFgColor onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7485
    cursorBgColor := cursorBgColor onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7486
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7487
    "Modified: 20.12.1996 / 14:16:05 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7488
    "Created: 24.7.1997 / 18:24:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7489
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7490
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7491
!EditTextView methodsFor:'redrawing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7492
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7493
redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7494
    "redraw the cursor, if it sits in a line range"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7495
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7496
    cursorShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7497
        cursorVisibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7498
            (cursorVisibleLine between:startVisLine and:endVisLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7499
                self drawCursorCharacter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7500
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7501
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7502
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7503
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7504
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7505
redrawCursorIfInVisibleLine:visLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7506
    "redraw the cursor, if it sits in visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7507
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7508
    cursorShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7509
        (visLine == cursorVisibleLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7510
            self drawCursorCharacter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7511
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7512
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7513
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7514
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7515
redrawFromVisibleLine:startVisLine to:endVisLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7516
    "redraw a visible line range"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7517
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7518
    super redrawFromVisibleLine:startVisLine to:endVisLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7519
    self redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7520
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7521
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7522
redrawVisibleLine:visLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7523
    "redraw a visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7524
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7525
    super redrawVisibleLine:visLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7526
    self redrawCursorIfInVisibleLine:visLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7527
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7528
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7529
redrawVisibleLine:visLine col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7530
    "redraw the single character in visibleline at colNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7531
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7532
    super redrawVisibleLine:visLine col:colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7533
    cursorShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7534
        (visLine == cursorVisibleLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7535
            (colNr == cursorCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7536
                self drawCursorCharacter.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7537
                ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7538
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7539
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7540
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7541
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7542
    "Modified: / 05-11-2007 / 17:35:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7543
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7544
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7545
redrawVisibleLine:visLine from:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7546
    "redraw a visible line from startCol to the end of line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7547
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7548
    super redrawVisibleLine:visLine from:startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7549
    cursorShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7550
        self redrawCursorIfInVisibleLine:visLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7551
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7552
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7553
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7554
redrawVisibleLine:visLine from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7555
    "redraw a visible line from startCol to endCol"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7556
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7557
    super redrawVisibleLine:visLine from:startCol to:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7558
    self redrawCursorIfInVisibleLine:visLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7559
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7560
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7561
!EditTextView methodsFor:'scrolling'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7562
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7563
additionalMarginForHorizontalScroll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7564
    "return the number of pixels by which we may scroll more than the actual
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7565
     width of the document would allow.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7566
     This is redefined by editable textViews, to allo for the cursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7567
     to be visible if it is positioned right behind the longest line of text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7568
     The default returned here is 10 pixels, which should be ok for most cursors"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7569
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7570
    ^ 10 max:gc font width
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7571
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7572
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7573
halfPageDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7574
    "half a page down - to keep cursor on same visible line, it has to be moved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7575
     within the real text  "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7576
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7577
    |prevCursorLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7578
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7579
    prevCursorLine := cursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7580
    super halfPageDown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7581
    self cursorVisibleLine:prevCursorLine col:cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7582
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7583
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7584
halfPageUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7585
    "half a page up - to keep cursor on same visible line, it has to be moved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7586
     within the real text  "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7587
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7588
    |prevCursorLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7589
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7590
    prevCursorLine := cursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7591
    super halfPageUp.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7592
    self cursorVisibleLine:prevCursorLine col:cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7593
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7594
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7595
originChanged:delta
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7596
    "sent after scrolling - have to show the cursor if it was on before"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7597
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7598
    super originChanged:delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7599
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7600
     should we move the cursor with the scroll - or leave it ?
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7601
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7602
    self updateCursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7603
    prevCursorState ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7604
        self showCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7605
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7606
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7607
    "Modified: / 17.6.1998 / 16:13:24 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7608
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7609
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7610
originWillChange
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7611
    "sent before scrolling - have to hide the cursor"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7612
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7613
    prevCursorState := cursorShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7614
    "/ cursorShown := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7615
    cursorShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7616
        self hideCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7617
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7618
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7619
    "Modified: / 6.7.1998 / 13:07:23 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7620
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7621
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7622
pageDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7623
    "page down - to keep cursor on same visible line, it has to be moved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7624
     within the real text  "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7625
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7626
    |prevCursorLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7627
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7628
    prevCursorLine := cursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7629
    super pageDown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7630
    self cursorVisibleLine:prevCursorLine col:cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7631
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7632
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7633
pageUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7634
    "page up - to keep cursor on same visible line, it has to be moved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7635
     within the real text  "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7636
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7637
    |prevCursorLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7638
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7639
    prevCursorLine := cursorVisibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7640
    super pageUp.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7641
    self cursorVisibleLine:prevCursorLine col:cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7642
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7643
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7644
!EditTextView methodsFor:'searching'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7645
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7646
searchBwd:pattern ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7647
    "do a backward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7648
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7649
    self searchBwd:pattern ignoreCase:false ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7650
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7651
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7652
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7653
    "do a backward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7654
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7655
    cursorLine isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7656
    super searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7657
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7658
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7659
searchBwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7660
    "do a backward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7661
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7662
    cursorLine isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7663
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7664
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7665
        searchBackwardFor:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7666
        ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7667
        startingAtLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7668
        ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7669
            self cursorMovementAllowed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7670
                self cursorLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7671
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7672
            self showMatch:pattern isMatch:false atLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7673
"/            self makeLineVisible:cursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7674
            typeOfSelection := #search]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7675
        ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7676
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7677
    "Modified: 9.10.1997 / 13:02:13 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7678
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7679
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7680
searchForAndSelectMatchingParenthesis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7681
    "select characters enclosed by matching parenthesis if one is under cusor"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7682
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7683
    self searchForAndSelectMatchingParenthesisFromLine:cursorLine col:cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7684
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7685
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7686
searchForMatchingParenthesis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7687
    "search for a matching parenthesis starting at cursor position.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7688
     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
  7689
     backwards if its a closing parenthesis.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7690
     Positions the cursor if found, peeps if not"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7691
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7692
    self cursorMovementAllowed ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7693
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7694
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7695
        searchForMatchingParenthesisFromLine:cursorLine col:cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7696
        ifFound:[:line :col | self cursorLine:line col:col]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7697
        ifNotFound:[self showNotFound]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7698
        onError:[self beep]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7699
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7700
    "Modified: 9.10.1997 / 12:56:30 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7701
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7702
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7703
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
  7704
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7705
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7706
    cursorLine isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7707
    self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7708
        searchForwardFor:pattern 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7709
        ignoreCase:ign
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7710
        match: match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7711
        startingAtLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7712
        ifFound:[:line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7713
            self cursorMovementAllowed ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7714
                self cursorLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7715
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7716
            self showMatch:pattern isMatch:match atLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7717
"/            self makeLineVisible:cursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7718
            typeOfSelection := #search
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7719
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7720
        ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7721
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7722
    "Modified: 9.10.1997 / 12:57:47 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7723
    "Created: 9.10.1997 / 13:01:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7724
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7725
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7726
searchFwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7727
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7728
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7729
    self searchFwd:pattern ignoreCase:ign match: false startingAtLine:startLine col:startCol ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7730
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7731
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7732
searchFwd:pattern startingAtLine:startLine col:startCol ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7733
    "do a forward search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7734
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7735
    self searchFwd:pattern ignoreCase:false startingAtLine:startLine col:startCol ifAbsent:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7736
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7737
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7738
searchPatternForSearchBar
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7739
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7740
    "Returns the next searchPattern from the user selection or from the autoSearch"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7741
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7742
    |searchPattern|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7743
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7744
    searchPattern := self searchPatternFromUserSelectionOrReplace.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7745
    searchPattern isNil 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7746
        ifTrue: [searchPattern := lastSearchPattern]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7747
        ifFalse: [lastSearchPattern := searchPattern].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7748
    ^ searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7749
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7750
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7751
setSearchPatternWithMatchEscapes: match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7752
    "set the searchpattern from the selection if there is one, and position
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7753
     cursor to start of pattern"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7754
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7755
    |sel|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7756
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7757
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7758
    "/ if the last operation was a replace, set pattern to last
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7759
    "/ original string (for search after again)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7760
    "/ for cut or delete actions allow lastReplacement with nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7761
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7762
"/    (lastStringFromReplaceForNextSearch notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7763
"/     and:[typeOfSelection ~~ #search]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7764
"/        lastStringFromReplaceForNextSearch isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7765
"/            lastSearchPattern := lastStringFromReplaceForNextSearch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7766
"/        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7767
"/            lastSearchPattern := lastStringFromReplaceForNextSearch asStringWithoutFinalCR.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7768
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7769
"/        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7770
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7771
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7772
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7773
    "/ if there is a selection:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7774
    "/    if there was no previous search, take it as search pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7775
    "/    if there was a previous search, only take the selection if
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7776
    "/    it did not result from a paste or from the last search itself.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7777
    "/    (to allow search-paste to be repeated)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7778
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7779
    sel := self selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7780
    sel notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7781
        (lastSearchPattern isNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7782
        or:[typeOfSelection ~~ #paste and:[typeOfSelection ~~ #search]]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7783
        ) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7784
            self cursorLine:selectionStartLine col:selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7785
            lastSearchPattern := sel asStringWithoutFinalCR.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7786
            match ifTrue:[lastSearchPattern := lastSearchPattern withMatchEscapes].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7787
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7788
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7789
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7790
    "Modified: / 07-05-2011 / 17:25:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7791
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7792
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7793
showMatch:pattern isMatch:isMatch atLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7794
    super showMatch:pattern isMatch:isMatch atLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7795
    typeOfSelection := #search.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7796
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7797
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7798
startPositionForSearchBackward
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7799
    ^ self startPositionForSearchBackwardBasedOnCursorOrSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7800
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7801
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7802
startPositionForSearchBackwardBasedOnCursorOrSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7803
    |startLine startCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7804
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7805
    selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7806
        startLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7807
        startCol := selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7808
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7809
        cursorLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7810
            startLine := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7811
            startCol := self listAt:startLine size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7812
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7813
            startLine := cursorLine min:list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7814
            startCol := cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7815
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7816
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7817
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7818
    ^ startCol @ cursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7819
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7820
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7821
startPositionForSearchForward
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7822
    ^ self startPositionForSearchForwardBasedOnCursorOrSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7823
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7824
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7825
startPositionForSearchForwardBasedOnCursorOrSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7826
    |startCol|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7827
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7828
    "/ if there is no selection and the cursor is at the origin,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7829
    "/ assume its the first search and do not skip the very first match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7830
    startCol := cursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7831
    self hasSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7832
        ^ selectionEndCol @ selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7833
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7834
        (cursorLine == 1 and:[cursorCol == 1]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7835
            startCol := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7836
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7837
        startCol := startCol min:(self at:cursorLine) size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7838
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7839
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7840
    ^ startCol @ cursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7841
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7842
    "Modified (format): / 24-05-2012 / 13:58:37 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7843
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7844
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7845
!EditTextView methodsFor:'selections'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7846
4973
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7847
addToSelectionAfter:aBlock 
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7848
    "Extends the selection accroding to cursor position
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7849
     after evaluation of `aBlock`. Used to implement
4973
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7850
     Shift-Up/Down/Left/Right, Shift-Home & Shift-End."
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7851
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7852
    "/ Following comment is in czech and thus now very useful.
4970
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  7853
    "/ However I (JV) kept it here as this is one of the very
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7854
    "/ first fix/hack we made to Smalltalk/X ages ago, if not
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7855
    "/ the very first one. Actually, this method and comment was 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7856
    "/ written by Martin Dvorak. Yeah, being bit nostalgic...
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7857
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7858
    "Pokud existuje selekce, upravi ji
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7859
     podle aktualni pozice kurzoru a pozice
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7860
     po provedeni blocku.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7861
     Urceno k implementaci Shift-Home a Shift-End
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7862
     Nejak nevim, jak to presneji popsat :-)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7863
4973
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7864
    | startLine startCol endLine endCol curLine curCol cursorAtTheBeginning cursorAtTheEnd cursorWasShown flip extModeStandard |
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7865
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7866
    curLine := cursorLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7867
    curCol := cursorCol.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7868
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7869
    self hasSelection ifTrue: [
4970
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  7870
        startLine := selectionStartLine.
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  7871
        startCol := selectionStartCol.
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  7872
        endLine := selectionEndLine.
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  7873
        endCol := selectionEndCol.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7874
    ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7875
        startLine := endLine := curLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7876
        startCol := curCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7877
        endCol := curCol - 1.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7878
    ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7879
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7880
    cursorAtTheBeginning := (startLine == curLine) and:[startCol == curCol].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7881
    cursorAtTheEnd := (endLine == curLine) and:[endCol == (curCol - 1)]. 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7882
    self assert: cursorAtTheBeginning | cursorAtTheEnd.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7883
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7884
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7885
    cursorWasShown := self hideCursor.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7886
    aBlock value.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7887
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7888
    cursorAtTheBeginning ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7889
        (cursorCol == (endCol + 1) and:[cursorLine == endLine]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7890
                self unselect; showCursor.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7891
                ^self
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7892
        ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7893
4973
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7894
        flip := cursorLine == endLine and:[cursorCol > endCol].
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7895
        flip ifTrue:[ 
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7896
            extModeStandard := UserPreferences current selectionExtensionMode == #standard.
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7897
        ].
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7898
        (cursorLine > endLine or:[flip]) ifTrue:[
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7899
            (flip and:[ extModeStandard ]) ifTrue:[
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7900
                startLine := endLine.
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7901
                startCol := endCol + 1.
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7902
            ].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7903
            endLine := cursorLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7904
            endCol := cursorCol - 1
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7905
        ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7906
            startLine := cursorLine.
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7907
            startCol := cursorCol.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7908
        ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7909
    ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7910
        cursorAtTheEnd ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7911
            (cursorCol == startCol and:[cursorLine == startLine]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7912
                self unselect; showCursor.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7913
                ^self
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7914
            ].
4973
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7915
            flip := cursorLine == startLine and:[cursorCol < startCol].
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7916
            flip ifTrue:[ 
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7917
                extModeStandard := UserPreferences current selectionExtensionMode == #standard.
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7918
            ].  
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7919
            (cursorLine < startLine or:[flip]) ifTrue:[
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7920
                (flip and:[ extModeStandard ]) ifTrue:[
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7921
                    endLine := startLine.
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7922
                    endCol := startCol - 1.
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7923
                ].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7924
                startLine := cursorLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7925
                startCol := cursorCol
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7926
            ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7927
                endLine := cursorLine.
4973
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7928
                endCol := cursorCol - 1.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7929
            ]
4823
0d685a9c7f5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4821
diff changeset
  7930
        ].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7931
    ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7932
    self selectFromLine:startLine col:startCol toLine: endLine col:endCol .
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7933
    cursorWasShown ifTrue:[self showCursor].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7934
4973
e78f1243d4ef Implemented #traditional and #standard selection extension modes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4970
diff changeset
  7935
    "Modified: / 27-03-2014 / 10:05:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4970
36ec8c9fde52 Fix for issue #36.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4969
diff changeset
  7936
    "Modified (comment): / 25-03-2014 / 17:18:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7937
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7938
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7939
autoMoveCursorToEndOfSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7940
    "return true, if the cursor should be automatically moved to the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7941
     end of a selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7942
     Redefined to return false in terminalViews, where the cursor should
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7943
     not be affected by selecting"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7944
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7945
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7946
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7947
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7948
changeTypeOfSelectionTo:newType
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7949
    typeOfSelection ~~ newType ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7950
        typeOfSelection := newType.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7951
        selectionStartLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7952
            self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7953
                redrawFromLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7954
                toLine:selectionEndLine col:selectionEndCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7955
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7956
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7957
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7958
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7959
findNextWordAfterSelectionAndAddToSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7960
    |selStartCol selStartLine selEndCol selEndLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7961
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7962
    selectionStartCol isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7963
        self selectWordUnderCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7964
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7965
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7966
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7967
    selStartCol := selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7968
    selEndCol := selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7969
    selStartLine := selectionStartLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7970
    selEndLine := selectionEndLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7971
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7972
    self cursorToNextWord.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7973
    self selectWordUnderCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7974
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7975
    self selectFromLine:selStartLine col:selStartCol toLine:selectionEndLine col:selectionEndCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7976
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7977
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7978
searchPatternFromUserSelectionOrReplace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7979
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7980
    |sel searchPattern|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7981
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7982
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7983
    "/ if the last operation was a replace, set pattern to last
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7984
    "/ original string (for search after again)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7985
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7986
    (lastStringFromReplaceForNextSearch notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7987
     and:[typeOfSelection ~~ #search]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7988
        lastStringFromReplaceForNextSearch isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7989
            searchPattern := lastStringFromReplaceForNextSearch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7990
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7991
            searchPattern := lastStringFromReplaceForNextSearch asStringWithoutFinalCR.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7992
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7993
        ^ searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7994
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7995
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7996
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7997
    "/ if there is a selection:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7998
    "/    if there was no previous search, take it as search pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  7999
    "/    if there was a previous search, only take the selection if
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8000
    "/    it did not result from a paste.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8001
    "/    (to allow search-paste to be repeated)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8002
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8003
    sel := self selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8004
    sel notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8005
        typeOfSelection ~~ #search ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8006
            typeOfSelection ~~ #paste ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8007
                self cursorLine:selectionStartLine col:selectionStartCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8008
                searchPattern := sel asStringWithoutFinalCR.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8009
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8010
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8011
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8012
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8013
    ^ searchPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8014
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8015
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8016
selectAll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8017
    "select the whole text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8018
     redefined to send super selectFrom... since we dont want the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8019
     cursor to be moved in this case."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8020
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8021
    list isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8022
        self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8023
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8024
        super 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
  8025
        typeOfSelection := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8026
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8027
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8028
    "Modified: 28.2.1997 / 19:14:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8029
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8030
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8031
selectAllInitially
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8032
    "select the whole text. This is called only once during the initialization
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8033
     for editFields which are shown in a table or tree.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8034
     The selectAll is called via this method to allow for easier redefinition and
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8035
     to distinguish auto-select from user-initiated selects."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8036
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8037
    self selectAll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8038
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8039
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8040
selectCursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8041
    "select cursorline"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8042
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8043
    self selectFromLine:cursorLine col:1 toLine:cursorLine+1 col:0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8044
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8045
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8046
selectCursorLineFromBeginning
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8047
    "select cursorline up to cursor position"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8048
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8049
    cursorCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8050
        self selectFromLine:cursorLine col:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8051
                     toLine:cursorLine col:(cursorCol-1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8052
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8053
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8054
    "Modified: 16.8.1996 / 19:14:14 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8055
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8056
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8057
selectExpandCursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8058
    "expand selection by one line or select cursorline"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8059
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8060
    selectionStartLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8061
        self selectCursorLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8062
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8063
        self selectFromLine:selectionStartLine col:selectionStartCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8064
                     toLine:cursorLine+1 col:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8065
        self makeLineVisible:selectionEndLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8066
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8067
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8068
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8069
selectFromBeginOfLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8070
    "select the text from the beginning of the current line to the current cursor position."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8071
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8072
    | newCursorCol ln |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8073
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8074
    list isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8075
        self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8076
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8077
        cursorCol > 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8078
            ln := list at: cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8079
            newCursorCol := ln notEmptyOrNil ifTrue:[ln indexOfNonSeparator] ifFalse:[1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8080
            self selectFromLine:cursorLine col:newCursorCol toLine:cursorLine col:cursorCol-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8081
            cursorCol := newCursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8082
            typeOfSelection := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8083
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8084
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8085
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8086
    "Created: / 28-06-2011 / 22:47:04 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8087
    "Modified: / 18-07-2012 / 17:00:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8088
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8089
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8090
selectFromBeginning
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8091
    "select the text from the beginning to the current cursor position."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8092
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8093
    |col|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8094
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8095
    list isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8096
        self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8097
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8098
        cursorCol == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8099
            col := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8100
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8101
            col := cursorCol - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8102
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8103
        super selectFromLine:1 col:1 toLine:cursorLine col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8104
        typeOfSelection := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8105
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8106
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8107
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8108
selectFromLine:startLine col:startCol toLine:endLine col:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8109
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8110
    super selectFromLine:startLine col:startCol toLine:endLine col:endCol.
4976
83f3df06495f Added documentation of what was changed (meant to change)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4975
diff changeset
  8111
    "JV: That's atctuall rubbish as then you loose the original positon
83f3df06495f Added documentation of what was changed (meant to change)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4975
diff changeset
  8112
     and if user wants to extend/shring the selection further, you don't know
83f3df06495f Added documentation of what was changed (meant to change)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4975
diff changeset
  8113
     from which end to do it!!"
83f3df06495f Added documentation of what was changed (meant to change)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4975
diff changeset
  8114
"/    (selectionEndLine notNil and:[self autoMoveCursorToEndOfSelection]) ifTrue:[
83f3df06495f Added documentation of what was changed (meant to change)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4975
diff changeset
  8115
"/        self cursorLine:selectionEndLine col:(selectionEndCol + 1).
83f3df06495f Added documentation of what was changed (meant to change)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4975
diff changeset
  8116
"/    ].
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8117
    typeOfSelection := nil
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  8118
4976
83f3df06495f Added documentation of what was changed (meant to change)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4975
diff changeset
  8119
    "Modified: / 27-08-2013 / 13:28:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
83f3df06495f Added documentation of what was changed (meant to change)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4975
diff changeset
  8120
    "Modified (comment): / 27-08-2013 / 15:58:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8121
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8122
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8123
selectToEndOfLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8124
    "select the text from the current cursor position to the end of the current line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8125
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8126
    | newCursorCol line |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8127
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8128
    list isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8129
        self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8130
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8131
        cursorCol >= 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8132
            line := list at: cursorLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8133
            newCursorCol := line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8134
            [ newCursorCol > 1 and:[(line at:newCursorCol) isSeparator] ]      
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8135
                whileTrue:[newCursorCol := newCursorCol - 1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8136
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8137
            self selectFromLine:cursorLine col:cursorCol toLine:cursorLine col: newCursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8138
            cursorCol := newCursorCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8139
            typeOfSelection := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8140
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8141
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8142
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8143
    "Created: / 28-06-2011 / 23:07:07 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8144
    "Modified: / 30-06-2011 / 19:51:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8145
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8146
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8147
selectUpToEnd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8148
    "select the text from the current cursor position to the end."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8149
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8150
    list isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8151
        self unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8152
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8153
        super selectFromLine:cursorLine col:cursorCol toLine:(list size + 1) col:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8154
        typeOfSelection := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8155
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8156
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8157
4878
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8158
selectWordAtLine:line col:col
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8159
    "select the word at given line/col"
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8160
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8161
    super selectWordAtLine:line col:col.
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8162
    "/ Most modern editors seem to position cursor to the end of the selection
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8163
    "/ when selecting word by double-click or shortcut.
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8164
    self cursorLine: selectionEndLine col: selectionEndCol + 1.
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8165
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8166
    "Created: / 25-11-2013 / 14:36:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8167
!
2f8e697b8a99 Bugfix - update cursor position after selecting word using double click or shortcut.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4857
diff changeset
  8168
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8169
selectWordUnderCursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8170
    "select the word under the cursor"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8171
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8172
    self selectWordAtLine:cursorLine col:cursorCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8173
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8174
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8175
unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8176
    "forget and unhilight selection - must take care of cursor here"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8177
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8178
    |wasOn|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8179
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8180
    wasOn := self hideCursor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8181
    super unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8182
    typeOfSelection := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8183
    wasOn ifTrue:[self showCursor]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8184
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8185
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8186
!EditTextView methodsFor:'undo & again'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8187
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8188
addUndo:action
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8189
    ^ undoSupport addUndo:action.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8190
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8191
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8192
again
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8193
    "repeat the last action (which was a cut or replace).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8194
     If current selection is not last string, search forward to
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8195
     next occurrence of it before repeating the last operation."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8196
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8197
    |s l c sel savedSelectStyle startColForSearch 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8198
     lastStringToReplace lastReplaceIgnoredCase lastReplaceWasMatch|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8199
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8200
    lastStringToReplace := lastReplacementInfo lastStringToReplace.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8201
    lastStringToReplace isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8202
        ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8203
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8204
    lastReplaceIgnoredCase := lastReplacementInfo lastReplaceIgnoredCase.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8205
    lastReplaceWasMatch := lastReplacementInfo lastReplaceWasMatch.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8206
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8207
    self undoableDo:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8208
        s := lastStringToReplace asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8209
        "remove final cr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8210
        (s endsWith:Character cr) ifTrue:[s := s copyButLast:1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8211
    "/        s := s withoutSpaces.        "XXX - replacing text with spaces ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8212
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8213
        "set lastStringToReplace as the next search string 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8214
         and set lastReplaceIgnoredCase as the next search ignored case flag"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8215
        lastStringFromReplaceForNextSearch := s.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8216
        lastSearchIgnoredCase := lastReplaceIgnoredCase.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8217
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8218
        savedSelectStyle := selectStyle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8219
        selectStyle := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8220
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8221
        sel := self selection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8222
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8223
        "if we are already there (after a find), ommit search"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8224
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8225
        (sel notNil and:[sel asString withoutSeparators = s]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8226
            l := selectionStartLine "cursorLine".
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8227
            c := selectionStartCol "cursorCol".
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8228
            self deleteSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8229
            lastReplacementInfo lastReplacement notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8230
                self insertLines:lastReplacementInfo lastReplacement asStringCollection withCR:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8231
                self selectFromLine:l col:c toLine:cursorLine col:(cursorCol - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8232
                typeOfSelection := #paste
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8233
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8234
            selectStyle := savedSelectStyle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8235
            ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8236
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8237
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8238
        sel isEmptyOrNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8239
            startColForSearch := cursorCol - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8240
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8241
            startColForSearch := selectionEndCol ? (cursorCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8242
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8243
        self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8244
            searchForwardFor:s
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8245
            ignoreCase: lastReplaceIgnoredCase 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8246
            match: lastReplaceWasMatch 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8247
            startingAtLine:cursorLine col:startColForSearch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8248
            ifFound:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8249
                [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8250
                    :line :col |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8251
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8252
                    |repl|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8253
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8254
                    self selectFromLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8255
                                 toLine:line col:(col + s size - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8256
                    self makeLineVisible:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8257
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8258
                    self deleteSelection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8259
                    lastReplacementInfo lastReplacement notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8260
                        lastReplacementInfo lastReplacement isString ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8261
                            repl := lastReplacementInfo lastReplacement asString "withoutSpaces"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8262
                        ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8263
                            repl := lastReplacementInfo lastReplacement "withoutSpaces".
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8264
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8265
                        self insertLines:repl asStringCollection withCR:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8266
                        self selectFromLine:line col:col toLine:cursorLine col:(cursorCol - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8267
                        undoSupport actionInfo:'replace'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8268
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8269
                    selectStyle := savedSelectStyle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8270
                    typeOfSelection := #paste.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8271
                    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8272
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8273
            ifAbsent:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8274
                [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8275
                    self sensor compressKeyPressEventsWithKey:#Again.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8276
                    self showNotFound.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8277
                    selectStyle := savedSelectStyle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8278
                    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8279
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8280
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8281
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8282
    ^ true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8283
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8284
    "Modified: 9.10.1996 / 16:14:11 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8285
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8286
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8287
hasRedoAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8288
    ^ undoSupport hasRedoAction.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8289
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8290
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8291
hasUndoAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8292
    ^ undoSupport hasUndoAction.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8293
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8294
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8295
multipleAgain
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8296
    "repeat the last action (which was a cut or replace) until search fails"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8297
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8298
    [self again] whileTrue:[]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8299
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8300
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8301
nonUndoableDo:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8302
    undoSupport nonUndoableDo:aBlock.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8303
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8304
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8305
redo
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8306
    "undo the last undo"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8307
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8308
    undoSupport hasRedoAction ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8309
        self beep
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8310
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8311
        undoSupport redo.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8312
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8313
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8314
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8315
undo
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8316
    "undo the last edit operation"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8317
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8318
    undoSupport hasUndoAction ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8319
        self beep
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8320
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8321
        undoSupport undo.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8322
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8323
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8324
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8325
undoableDo:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8326
    self undoableDo:aBlock info:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8327
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8328
    "Modified: / 28-07-2007 / 13:20:14 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8329
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8330
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8331
undoableDo:aBlock info:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8332
    self checkModificationsAllowed ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8333
        "/ will trigger an error-dialog there (no need for undo-carekeeping)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8334
        aBlock value.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8335
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8336
        undoSupport undoableDo:aBlock info:aString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8337
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8338
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8339
    "Modified: / 28-07-2007 / 13:21:00 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8340
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8341
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8342
!EditTextView::EditAction class methodsFor:'instance creation'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8343
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8344
line1:arg1 col1:arg2 line2:arg3 col2:arg4
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8345
    ^ self new line1:arg1 col1:arg2 line2:arg3 col2:arg4
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8346
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8347
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8348
line1:arg1 col1:arg2 line2:arg3 col2:arg4 info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8349
    ^ (self new line1:arg1 col1:arg2 line2:arg3 col2:arg4) info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8350
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8351
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8352
line:arg1 col:arg2 character:arg3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8353
    ^ self new line:arg1 col:arg2 character:arg3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8354
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8355
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8356
line:arg1 col:arg2 character:arg3 info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8357
    ^ (self new line:arg1 col:arg2 character:arg3) info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8358
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8359
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8360
line:arg1 col:arg2 characters:arg3 info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8361
    ^ (self new line:arg1 col:arg2 characters:arg3) info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8362
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8363
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8364
line:arg1 col:arg2 info:arg3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8365
    ^ self new line:arg1 col:arg2 info:arg3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8366
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8367
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8368
line:arg1 col:arg2 string:arg3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8369
    ^ self new line:arg1 col:arg2 string:arg3
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8370
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8371
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8372
line:arg1 col:arg2 string:arg3 info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8373
    ^ (self new line:arg1 col:arg2 string:arg3) info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8374
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8375
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8376
line:arg1 string:arg3 info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8377
    ^ (self new line:arg1 string:arg3) info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8378
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8379
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8380
text:arg info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8381
    ^ (self new text:arg) info:info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8382
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8383
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8384
!EditTextView::EditAction methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8385
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8386
info
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8387
    ^ userFriendlyInfo
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8388
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8389
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8390
info:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8391
    userFriendlyInfo := aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8392
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8393
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8394
!EditTextView::EditAction methodsFor:'combining'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8395
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8396
canCombineWithPreviousPasteStringAction: aPasteStringAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8397
    ^ false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8398
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8399
    "Created: / 25-09-2006 / 12:16:25 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8400
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8401
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8402
!EditTextView::EditAction methodsFor:'queries'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8403
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8404
canCombineWithNext:nextAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8405
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8406
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8407
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8408
!EditTextView::DeleteRange methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8409
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8410
line1:line1Arg col1:col1Arg line2:line2Arg col2:col2Arg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8411
    "set instance variables (automatically generated)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8412
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8413
    self assert:(line1Arg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8414
    self assert:(col1Arg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8415
    self assert:(line2Arg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8416
    self assert:(col2Arg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8417
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8418
    line1 := line1Arg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8419
    col1 := col1Arg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8420
    line2 := line2Arg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8421
    col2 := col2Arg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8422
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8423
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8424
!EditTextView::DeleteRange methodsFor:'execution'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8425
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8426
executeIn:editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8427
    editor unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8428
    editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8429
        deleteFromLine:line1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8430
        col:col1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8431
        toLine:line2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8432
        col:col2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8433
    editor cursorLine:line1 col:col1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8434
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8435
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8436
!EditTextView::DeleteCharacters methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8437
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8438
col1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8439
    ^ col1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8440
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8441
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8442
col2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8443
    ^ col2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8444
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8445
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8446
line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8447
    ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8448
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8449
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8450
line:lineArg col1:col1Arg col2:col2Arg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8451
    "set instance variables (automatically generated)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8452
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8453
    self assert:(lineArg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8454
    self assert:(col1Arg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8455
    self assert:(col2Arg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8456
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8457
    line := lineArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8458
    col1 := col1Arg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8459
    col2 := col2Arg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8460
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8461
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8462
line:lineArg col:colArg info:infoArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8463
    self assert:(lineArg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8464
    self assert:(colArg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8465
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8466
    line := lineArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8467
    col1 := col2 := colArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8468
    self info:infoArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8469
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8470
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8471
!EditTextView::DeleteCharacters methodsFor:'combining'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8472
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8473
canCombineWithNext:anotherAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8474
    ^ anotherAction perform:#canCombineWithPreviousDeleteCharactersAction: with:self ifNotUnderstood:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8475
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8476
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8477
canCombineWithPreviousDeleteCharactersAction:previousDeleteAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8478
    "I will combine only if we both are single character deletes,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8479
     and my col-to-delete is the next after anotherDeleteActions col-to-delete.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8480
     (i.e. single-character typing)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8481
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8482
    previousDeleteAction line == line ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8483
        previousDeleteAction col2 == (col1-1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8484
            ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8485
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8486
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8487
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8488
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8489
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8490
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8491
combineWithNext:nextDeleteAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8492
    self assert:(line == nextDeleteAction line).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8493
    self assert:(col2 == (nextDeleteAction col1 - 1)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8494
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8495
    col2 := nextDeleteAction col2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8496
    userFriendlyInfo := 'insert ' , (col2 - col1 + 1) printString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8497
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8498
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8499
!EditTextView::DeleteCharacters methodsFor:'execution'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8500
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8501
executeIn:editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8502
    editor unselect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8503
    editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8504
        deleteFromLine:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8505
        col:col1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8506
        toLine:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8507
        col:col2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8508
    editor cursorLine:line col:col1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8509
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8510
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8511
!EditTextView::EditMode class methodsFor:'constants'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8512
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8513
insertAndSelectMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8514
    ^ InsertAndSelectMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8515
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8516
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8517
insertMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8518
    ^ InsertMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8519
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8520
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8521
overwriteMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8522
    ^ OverwriteMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8523
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8524
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8525
!EditTextView::EditMode class methodsFor:'queries'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8526
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8527
isInsertAndSelectMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8528
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8529
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8530
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8531
isInsertMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8532
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8533
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8534
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8535
symbolicName
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8536
    self subclassResponsibility
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8537
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8538
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8539
!EditTextView::EditMode::InsertAndSelectMode class methodsFor:'info'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8540
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8541
infoPrintString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8542
    ^ 'IS'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8543
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8544
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8545
!EditTextView::EditMode::InsertAndSelectMode class methodsFor:'queries'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8546
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8547
isInsertAndSelectMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8548
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8549
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8550
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8551
isInsertMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8552
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8553
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8554
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8555
!EditTextView::EditMode::InsertMode class methodsFor:'info'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8556
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8557
infoPrintString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8558
    ^ 'I'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8559
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8560
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8561
!EditTextView::EditMode::InsertMode class methodsFor:'queries'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8562
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8563
isInsertMode
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8564
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8565
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8566
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8567
!EditTextView::EditMode::OverwriteMode class methodsFor:'info'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8568
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8569
infoPrintString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8570
    ^ 'O'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8571
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8572
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8573
!EditTextView::LastReplacementInfo methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8574
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8575
lastReplaceIgnoredCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8576
    ^ lastReplaceIgnoredCase ? false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8577
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8578
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8579
lastReplaceIgnoredCase:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8580
    lastReplaceIgnoredCase := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8581
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8582
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8583
lastReplaceWasMatch
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8584
    ^ lastReplaceWasMatch ? false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8585
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8586
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8587
lastReplaceWasMatch:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8588
    lastReplaceWasMatch := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8589
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8590
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8591
lastReplacement
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8592
    ^ lastReplacement
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8593
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8594
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8595
lastReplacement:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8596
"/Transcript showCR: 'lastReplacement:', something printString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8597
    lastReplacement := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8598
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8599
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8600
lastStringToReplace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8601
    ^ lastStringToReplace
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8602
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8603
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8604
lastStringToReplace:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8605
    lastStringToReplace := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8606
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8607
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8608
previousReplacements
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8609
    ^ previousReplacements ? #()
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8610
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8611
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8612
stillCollectingInput
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8613
    ^ stillCollectingInput
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8614
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8615
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8616
stillCollectingInput:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8617
    stillCollectingInput := aBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8618
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8619
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8620
!EditTextView::LastReplacementInfo methodsFor:'history'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8621
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8622
rememberReplacement
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8623
    "remember the previous replacement (called when a new one appears).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8624
     Mostly for the benefit of the code completion..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8625
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8626
    |oldString newString|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8627
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8628
    oldString := lastStringToReplace.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8629
    newString := lastReplacement.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8630
    (oldString notEmptyOrNil and:[newString notEmptyOrNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8631
        previousReplacements isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8632
            previousReplacements := OrderedCollection new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8633
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8634
        previousReplacements := previousReplacements reject:[:entry | entry key = oldString].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8635
        previousReplacements addFirst:(oldString -> newString).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8636
        previousReplacements size > 20 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8637
            previousReplacements removeLast.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8638
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8639
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8640
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8641
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8642
!EditTextView::PasteString methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8643
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8644
col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8645
    ^ col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8646
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8647
    "Created: / 25-09-2006 / 12:19:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8648
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8649
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8650
col2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8651
    ^ col + string size - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8652
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8653
    "Created: / 25-09-2006 / 12:20:18 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8654
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8655
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8656
line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8657
    ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8658
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8659
    "Created: / 25-09-2006 / 12:21:08 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8660
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8661
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8662
line:lineArg col:colArg string:stringArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8663
    self assert:(lineArg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8664
    self assert:(colArg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8665
    self assert:(stringArg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8666
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8667
    line := lineArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8668
    col := colArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8669
    string := stringArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8670
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8671
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8672
line:lineArg col:colArg string:stringArg selected:selectedArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8673
    self assert:(lineArg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8674
    self assert:(colArg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8675
    self assert:(stringArg notNil).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8676
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8677
    line := lineArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8678
    col := colArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8679
    string := stringArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8680
    selected := selectedArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8681
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8682
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8683
string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8684
    ^ string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8685
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8686
    "Created: / 25-09-2006 / 12:25:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8687
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8688
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8689
!EditTextView::PasteString methodsFor:'combining'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8690
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8691
canCombineWithNext:anotherAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8692
    ^ anotherAction canCombineWithPreviousPasteStringAction:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8693
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8694
    "Created: / 25-09-2006 / 12:15:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8695
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8696
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8697
canCombineWithPreviousPasteStringAction: previousPasteAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8698
    "I will combine only if we both are single character inserts,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8699
     and my col-to-insert is the next after anotherInsertActions end-col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8700
     (i.e. single-character deletes)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8701
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8702
    previousPasteAction line == line ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8703
        previousPasteAction col == (self col2+1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8704
            ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8705
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8706
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8707
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8708
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8709
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8710
    "Modified: / 25-09-2006 / 12:22:21 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8711
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8712
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8713
combineWithNext:nextPasteAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8714
    |s1 s2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8715
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8716
    self assert:(line == nextPasteAction line).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8717
    self assert:((col - 1) == (nextPasteAction col2)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8718
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8719
    s1 := nextPasteAction string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8720
    s1 isString ifFalse:[s1 := s1 asStringWith:nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8721
    s2 := string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8722
    s2 isString ifFalse:[s2 := s2 asStringWith:nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8723
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8724
    string := s1, s2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8725
    col := nextPasteAction col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8726
    userFriendlyInfo := 'delete ' , string size printString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8727
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8728
    "Created: / 25-09-2006 / 12:24:10 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8729
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8730
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8731
!EditTextView::PasteString methodsFor:'execution'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8732
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8733
executeIn:editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8734
    editor cursorLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8735
    editor paste:string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8736
    selected ~~ true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8737
        editor unselect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8738
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8739
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8740
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8741
!EditTextView::ReplaceCharacter methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8742
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8743
col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8744
    ^ col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8745
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8746
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8747
col1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8748
    ^ col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8749
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8750
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8751
col2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8752
    ^ col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8753
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8754
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8755
line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8756
    ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8757
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8758
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8759
line:lineArg col:colArg character:characterArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8760
    line := lineArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8761
    col := colArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8762
    character := characterArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8763
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8764
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8765
!EditTextView::ReplaceCharacter methodsFor:'execution'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8766
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8767
executeIn:editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8768
    editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8769
        replace:character
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8770
        atLine:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8771
        col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8772
    editor cursorLine:line col:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8773
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8774
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8775
!EditTextView::ReplaceCharacters methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8776
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8777
characters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8778
    ^ characters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8779
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8780
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8781
col1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8782
    ^ col1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8783
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8784
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8785
col2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8786
    ^ col2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8787
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8788
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8789
line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8790
    ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8791
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8792
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8793
line:lineArg col:colArg character:characterArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8794
    line := lineArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8795
    col1 := col2 := colArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8796
    characters := characterArg asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8797
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8798
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8799
line:lineArg col:colArg characters:charactersArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8800
    line := lineArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8801
    col1 := colArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8802
    characters := charactersArg asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8803
    col2 := col1 + charactersArg size - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8804
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8805
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8806
!EditTextView::ReplaceCharacters methodsFor:'combining'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8807
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8808
canCombineWithNext:anotherAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8809
    ^ anotherAction perform:#canCombineWithPreviousReplaceCharactersAction: with:self ifNotUnderstood:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8810
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8811
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8812
canCombineWithPreviousReplaceCharactersAction:previousReplaceAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8813
    "I will combine only if we both are single character deletes,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8814
     and my col-to-delete is the next after anotherDeleteActions col-to-delete.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8815
     (i.e. single-character typing)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8816
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8817
    previousReplaceAction line == line ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8818
        previousReplaceAction col2 == (col1-1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8819
            ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8820
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8821
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8822
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8823
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8824
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8825
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8826
combineWithNext:nextReplaceAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8827
    self assert:(line == nextReplaceAction line).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8828
    self assert:(self col2 == (nextReplaceAction col1 - 1)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8829
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8830
    col2 := nextReplaceAction col2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8831
    userFriendlyInfo := 'replace ' , (col2 - col1 + 1) printString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8832
    characters := characters , nextReplaceAction characters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8833
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8834
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8835
!EditTextView::ReplaceCharacters methodsFor:'execution'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8836
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8837
executeIn:editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8838
    editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8839
        replaceString:characters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8840
        atLine:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8841
        col:col1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8842
    editor cursorLine:line col:col1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8843
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8844
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8845
!EditTextView::ReplaceContents methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8846
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8847
text:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8848
    text := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8849
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8850
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8851
!EditTextView::ReplaceContents methodsFor:'execution'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8852
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8853
executeIn:editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8854
    editor contents:text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8855
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8856
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8857
!EditTextView::ReplaceLine methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8858
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8859
line:lineArg string:stringArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8860
    line := lineArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8861
    text := stringArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8862
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8863
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8864
!EditTextView::ReplaceLine methodsFor:'execution'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8865
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8866
executeIn:editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8867
    editor list at:line put:text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8868
    editor invalidateLine:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8869
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8870
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8871
!EditTextView::ReplaceLines methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8872
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8873
line:lineArg lines:lineCollectionArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8874
    line := lineArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8875
    text := lineCollectionArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8876
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8877
    "Created: / 09-10-2006 / 10:35:22 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8878
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8879
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8880
!EditTextView::ReplaceLines methodsFor:'execution'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8881
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8882
executeIn:editor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8883
    |lnr|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8884
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8885
    lnr := line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8886
    text do:[:eachLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8887
        editor list at:lnr put:eachLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8888
        editor invalidateLine:lnr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8889
        lnr := lnr + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8890
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8891
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8892
    "Modified: / 09-10-2006 / 10:39:16 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8893
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8894
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8895
!EditTextView class methodsFor:'documentation'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8896
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8897
version
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8898
    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.604.2.1 2014-05-08 08:30:56 stefan Exp $'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8899
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8900
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8901
version_CVS
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8902
    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.604.2.1 2014-05-08 08:30:56 stefan Exp $'
4843
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  8903
!
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  8904
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  8905
version_HG
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  8906
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  8907
    ^ '$Changeset: <not expanded> $'
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8908
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  8909