[squeak-dev] The Trunk: Morphic-mt.1386.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jan 3 08:48:42 UTC 2018


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1386.mcz

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

Name: Morphic-mt.1386
Author: mt
Time: 3 January 2018, 9:48:33.350816 am
UUID: f9d1c8e8-849f-9d4b-8529-c1b163677c65
Ancestors: Morphic-eem.1385

Text drag/drop: Creates a composite undo/redo if source and target are the same morph/editor.

Note that drag-dropping text between text morphs (i.e. windows or panes) is not affected. You have to focus and undo/redo separately.

Do-it the following example to drop text from a source that does not  use the TextMorph/TextEditor mechanism:

ActiveHand grabMorph: (TransferMorph withPassenger: 'Hello, World!' asText from: nil).

=============== Diff against Morphic-eem.1385 ===============

Item was changed:
  ----- Method: TextMorphForEditView>>acceptDroppingMorph:event: (in category 'dropping/grabbing') -----
  acceptDroppingMorph: aTransferMorph event: evt
  	"Accept a text to be inserted at the event/cursor position. Either remove or keep the source text depending on the transfer morph's copy state."
  	
+ 	| sourceEditor |
+ 	sourceEditor := (aTransferMorph source respondsTo: #editor)
+ 		ifTrue: [aTransferMorph source editor]
+ 		ifFalse: [nil].
+ 
  	self
  		handleInteraction: [
+ 			
+ 			"1) Delete selection if it is a move operation."
+ 			(aTransferMorph shouldCopy or: [sourceEditor isNil]) ifFalse: [
+ 				sourceEditor destructiveBackWord.
+ 				sourceEditor == self editor
+ 					ifTrue: [self editor history previous isCompositeRedo: true]].
+ 			
+ 			"2) Insert selection at new place."
+ 			self editor addText: aTransferMorph passenger asText event: evt.
+ 			sourceEditor == self editor
+ 				ifTrue: [self editor history previous isCompositeUndo: true]]
+ 
- 			aTransferMorph shouldCopy
- 				ifFalse: [(aTransferMorph source respondsTo: #editor)
- 					ifTrue: [aTransferMorph source editor destructiveBackWord]].
- 			self editor addText: aTransferMorph passenger asText event: evt]
  		fromEvent: evt.
  	
  	evt hand newKeyboardFocus: self.!



More information about the Squeak-dev mailing list