Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.828.mcz==================== Summary ====================
Name: Morphic-mt.828
Author: mt
Time: 7 April 2015, 9:15:30.956 am
UUID: 2e54911e-bc9b-9a45-9ff7-cc94cbc373f7
Ancestors: Morphic-mt.827
Pluggable text morph can now notify about any text modification to the model -- not only accepts.
=============== Diff against Morphic-mt.827 ===============
Item was changed:
ScrollPane subclass: #PluggableTextMorph
+ instanceVariableNames: 'textMorph getTextSelector setTextSelector getSelectionSelector hasUnacceptedEdits askBeforeDiscardingEdits selectionInterval hasEditingConflicts editTextSelector'
- instanceVariableNames: 'textMorph getTextSelector setTextSelector getSelectionSelector hasUnacceptedEdits askBeforeDiscardingEdits selectionInterval hasEditingConflicts'
classVariableNames: 'AdornmentCache SimpleFrameAdornments'
poolDictionaries: ''
category: 'Morphic-Pluggable Widgets'!
Item was added:
+ ----- Method: PluggableTextMorph>>editTextSelector (in category 'accessing') -----
+ editTextSelector
+
+ ^ editTextSelector!
Item was added:
+ ----- Method: PluggableTextMorph>>editTextSelector: (in category 'accessing') -----
+ editTextSelector: aSymbol
+
+ editTextSelector := aSymbol.!
Item was added:
+ ----- Method: PluggableTextMorph>>textEdited: (in category 'editor access') -----
+ textEdited: someText
+ "Tell the model about some edits in the text if interested. This is not #accept, which means that it will be send on every keystroke."
+
+ self editTextSelector ifNotNil: [:selector |
+ model perform: selector with: someText].!
Item was changed:
----- Method: TextMorphForEditView>>keyStroke: (in category 'event handling') -----
keyStroke: evt
| view |
editView deleteBalloon.
(editView scrollByKeyboard: evt) ifTrue: [^self].
self editor model: editView model. "For evaluateSelection"
view := editView. "Copy into temp for case of a self-mutating doit"
(acceptOnCR and: [evt keyCharacter = Character cr])
ifTrue: [^ self editor accept].
super keyStroke: evt.
+ view scrollSelectionIntoView.
+
+ "Make a cheap check and guess editing. (Alternative would be to copy the old contents and then compare them against the new ones. Maybe add a better hook in the TextEditor."
+ (evt keyCharacter isAlphaNumeric or: [evt keyCharacter isSeparator])
+ ifTrue: [view textEdited: self contents].!
- view scrollSelectionIntoView!