The Trunk: 51Deprecated-mt.12.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: 51Deprecated-mt.12.mcz

commits-2
Marcel Taeumel uploaded a new version of 51Deprecated to project The Trunk:
http://source.squeak.org/trunk/51Deprecated-mt.12.mcz

==================== Summary ====================

Name: 51Deprecated-mt.12
Author: mt
Time: 13 November 2015, 10:16:11.223 am
UUID: 3f1371bf-2a60-4201-8314-9621e81b9f74
Ancestors: 51Deprecated-mt.11

Adds deprecated EditCommand class.

=============== Diff against 51Deprecated-mt.11 ===============

Item was changed:
  SystemOrganization addCategory: #'51Deprecated-Files-Kernel'!
  SystemOrganization addCategory: #'51Deprecated-Morphic-Support'!
+ SystemOrganization addCategory: #'51Deprecated-Morphic-Text Support'!

Item was added:
+ Object subclass: #EditCommand
+ instanceVariableNames: 'textMorph phase replacedText replacedTextInterval newText newTextInterval lastSelectionInterval'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: '51Deprecated-Morphic-Text Support'!
+
+ !EditCommand commentStamp: '<historical>' prior: 0!
+ This class handles all paragraph surgery in VI. In general, subclasses of EditCommand should be able to rely on the super class' undo/redo machinery -- only the repeat command needs to be overridden in most cases. This assumes, of course, that the newText, replacedText, newTextInterval, and replacedTextInterval have been set correctly.
+
+ When setting the interval, use normal mode style selections, not insert mode selections (see class comment of VIMorphEditor).
+
+ Possible useful expressions for doIt or printIt.
+
+ Structure:
+  instVar1 type -- comment about the purpose of instVar1
+  instVar2 type -- comment about the purpose of instVar2
+
+ Any further useful comments about the general approach of this implementation.!

Item was added:
+ ----- Method: EditCommand class>>textMorph:replacedText:replacedTextInterval:newText:newTextInterval: (in category 'instance creation') -----
+ textMorph: tm
+ replacedText: replacedText
+ replacedTextInterval: replacedTextInterval
+ newText: newText
+ newTextInterval: newTextInterval
+
+
+ ^(self new)
+ textMorph: tm
+ replacedText: replacedText
+ replacedTextInterval: replacedTextInterval
+ newText: newText
+ newTextInterval: newTextInterval;
+ yourself
+
+ !

Item was added:
+ ----- Method: EditCommand>>doCommand (in category 'command execution') -----
+ doCommand
+
+ ^self redoCommand
+
+ !

Item was added:
+ ----- Method: EditCommand>>doSelectionInterval (in category 'selection') -----
+ doSelectionInterval
+ ^self redoSelectionInterval!

Item was added:
+ ----- Method: EditCommand>>iEditCommand (in category 'accessors') -----
+ iEditCommand
+ ^true!

Item was added:
+ ----- Method: EditCommand>>lastSelectionInterval (in category 'accessors') -----
+ lastSelectionInterval
+ ^lastSelectionInterval!

Item was added:
+ ----- Method: EditCommand>>newText (in category 'accessors') -----
+ newText
+ ^newText!

Item was added:
+ ----- Method: EditCommand>>newText: (in category 'accessors') -----
+ newText: aText
+ ^newText := aText!

Item was added:
+ ----- Method: EditCommand>>newTextInterval (in category 'accessors') -----
+ newTextInterval
+ ^newTextInterval!

Item was added:
+ ----- Method: EditCommand>>newTextInterval: (in category 'accessors') -----
+ newTextInterval: anInterval
+ ^newText := anInterval!

Item was added:
+ ----- Method: EditCommand>>pEditor (in category 'accessors') -----
+ pEditor
+ ^textMorph editor
+ !

Item was added:
+ ----- Method: EditCommand>>phase (in category 'accessors') -----
+ phase
+ ^phase
+ !

Item was added:
+ ----- Method: EditCommand>>phase: (in category 'accessors') -----
+ phase: aSymbol
+ ^phase := aSymbol
+ !

Item was added:
+ ----- Method: EditCommand>>printOn: (in category 'accessors') -----
+ printOn: aStream
+
+ | |
+ aStream
+ nextPutAll: self class name;
+ nextPut: $[;
+ nextPutAll: ('new: ', newTextInterval asString,' -> "', newText, '", rText: ', replacedTextInterval asString,' -> "', replacedText, '"');
+ nextPut: $].!

Item was added:
+ ----- Method: EditCommand>>redoCommand (in category 'command execution') -----
+ redoCommand
+
+ | |
+
+ "Debug dShow: ('rInterval: ', replacedTextInterval asString, '. rText: ', replacedText string, ' nInterval: ', newTextInterval asString, ' nText: ', newText string)."
+ self textMorphEditor
+ noUndoReplace: replacedTextInterval
+ with: newText.
+
+ "Debug dShow: ('lastSelInt: ', lastSelectionInterval asString)."
+ !

Item was added:
+ ----- Method: EditCommand>>redoSelectionInterval (in category 'selection') -----
+ redoSelectionInterval
+ "Return an interval to be displayed as a subtle selection after undo, or nil"
+
+ ^newTextInterval
+ !

Item was added:
+ ----- Method: EditCommand>>replacedText (in category 'accessors') -----
+ replacedText
+ ^replacedText!

Item was added:
+ ----- Method: EditCommand>>replacedText: (in category 'accessors') -----
+ replacedText: aText
+ ^replacedText := aText!

Item was added:
+ ----- Method: EditCommand>>replacedTextInterval (in category 'accessors') -----
+ replacedTextInterval
+ ^replacedTextInterval!

Item was added:
+ ----- Method: EditCommand>>replacedTextInterval: (in category 'accessors') -----
+ replacedTextInterval: anInterval
+ ^replacedTextInterval := anInterval!

Item was added:
+ ----- Method: EditCommand>>textMorph:replacedText:replacedTextInterval:newText:newTextInterval: (in category 'initialization') -----
+ textMorph: tm
+ replacedText: rText
+ replacedTextInterval: rInterval
+ newText: nText
+ newTextInterval: nInterval
+
+
+ textMorph := tm.
+ replacedText := rText.
+ replacedTextInterval := rInterval.
+ newText := nText.
+ newTextInterval := nInterval.
+
+ !

Item was added:
+ ----- Method: EditCommand>>textMorphEditor (in category 'accessors') -----
+ textMorphEditor
+ ^textMorph editor
+ !

Item was added:
+ ----- Method: EditCommand>>textMorphString (in category 'accessors') -----
+ textMorphString
+ ^textMorph text string
+ !

Item was added:
+ ----- Method: EditCommand>>textMorphStringSize (in category 'accessors') -----
+ textMorphStringSize
+ ^textMorph text string size
+ !

Item was added:
+ ----- Method: EditCommand>>undoCommand (in category 'command execution') -----
+ undoCommand
+
+ "Debug dShow: ('new Interval: ', newTextInterval asString, '. rText: ', replacedText string)."
+
+ self textMorphEditor
+ noUndoReplace: newTextInterval
+ with: replacedText.
+
+
+ !

Item was added:
+ ----- Method: EditCommand>>undoSelection (in category 'selection') -----
+ undoSelection
+ "Return an interval to be displayed as a selection after undo, or nil"
+
+ ^replacedTextInterval first to: (replacedTextInterval first + replacedText size - 1)
+ !

Item was added:
+ ----- Method: EditCommand>>undoSelectionInterval (in category 'selection') -----
+ undoSelectionInterval
+ "Return an interval to be displayed as a selection after undo, or nil"
+
+ | i |
+ i := (replacedTextInterval first min: self textMorphStringSize).
+ ^i to: i - 1
+ !