[squeak-dev] The Trunk: Morphic-cmm.384.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 17 22:16:09 UTC 2010

Chris Muller uploaded a new version of Morphic to project The Trunk:

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

Name: Morphic-cmm.384
Author: cmm
Time: 17 March 2010, 5:14:45.079 pm
UUID: 91657dcb-55b0-40b0-98ca-be0fbae37d54
Ancestors: Morphic-nice.383, Morphic-cmm.383

- Factored #addMenuItem: out of Morph>>#addItem: so clients can add alternatives to MenuItemMorph's to menus.
- Third-party applications are now allowed to handle the drop of a TransferMorph directly on to the desktop.  By specifying a #transferMorphConverter for the World to answer the Morph to be dropped, transferMorphs can be be accepted directly onto the desktop.  This is crucial for integration of Squeak's browsers into alternative IDE's like Maui.

=============== Diff against Morphic-nice.383 ===============

Item was added:
+ ----- Method: PasteUpMorph>>transferMorphConverter: (in category 'dropping/grabbing') -----
+ transferMorphConverter: aMessageSend 
+ 	self
+ 		setProperty: #transferMorphConverter
+ 		toValue: aMessageSend!

Item was added:
+ ----- Method: TransferMorph>>morphToDropInPasteUp: (in category 'dropping/grabbing') -----
+ morphToDropInPasteUp: aPasteUpMorph
+ 	^ aPasteUpMorph morphToDropForTransferMorph: self!

Item was added:
+ ----- Method: Morph>>morphToDropInPasteUp: (in category 'dropping/grabbing') -----
+ morphToDropInPasteUp: aPasteUp
+ 	^ self!

Item was added:
+ ----- Method: MenuMorph>>addMenuItem: (in category 'construction') -----
+ addMenuItem: aMenuItemMorph
+ 	self addMorphBack: aMenuItemMorph!

Item was added:
+ ----- Method: PasteUpMorph>>resetTransferMorphConverter (in category 'dropping/grabbing') -----
+ resetTransferMorphConverter
+ 	^ self transferMorphConverter: #yourself!

Item was added:
+ ----- Method: PasteUpMorph>>transferMorphConverter (in category 'dropping/grabbing') -----
+ transferMorphConverter
+ 	^self
+ 		valueOfProperty: #transferMorphConverter
+ 		ifAbsent: [ #yourself ]!

Item was changed:
  ----- Method: PasteUpMorph>>morphToDropFrom: (in category 'dropping/grabbing') -----
  morphToDropFrom: aMorph 
  	"Given a morph being carried by the hand, which the hand is about to drop, answer the actual morph to be deposited.  Normally this would be just the morph itself, but several unusual cases arise, which this method is designed to service."
  	| aNail representee handy posBlock |
  	handy := self primaryHand.
  	posBlock := 
  			[:z | | tempPos | 
  			tempPos := handy position 
  						- ((handy targetOffset - aMorph formerPosition) 
  								* (z extent / aMorph extent)) rounded.
  			self pointFromWorld: tempPos].
  	self alwaysShowThumbnail 
  			[aNail := aMorph 
  						representativeNoTallerThan: self maxHeightToAvoidThumbnailing
  						norWiderThan: self maximumThumbnailWidth
  						thumbnailHeight: self heightForThumbnails.
  			aNail == aMorph 
  					[aMorph formerPosition: aMorph position.
  					aNail position: (posBlock value: aNail)].
  	((aMorph isKindOf: MorphThumbnail) 
  		and: [(representee := aMorph morphRepresented) owner isNil]) 
  				[representee position: (posBlock value: representee).
  	self showingListView 
  				listViewLineForFieldList: (self valueOfProperty: #fieldListSelectors)].
  	(aMorph hasProperty: #newPermanentScript) 
  		ifTrue: [^aMorph asEmptyPermanentScriptor].
  	((aMorph isPhraseTileMorph) or: [aMorph isSyntaxMorph]) 
+ 		ifFalse: [^aMorph morphToDropInPasteUp: self].
- 		ifFalse: [^aMorph].
  	aMorph userScriptSelector isEmptyOrNil 
  			self automaticPhraseExpansion ifFalse: [^aMorph]].
  	^aMorph morphToDropInPasteUp: self!

Item was changed:
  Morph subclass: #TransferMorph
+ 	instanceVariableNames: 'transferType passenger draggedMorph source dropNotifyRecipient resultRecipient copy'
- 	instanceVariableNames: 'transferType passenger draggedMorph source dropNotifyRecipient accepted resultRecipient copy'
  	classVariableNames: 'CopyPlusIcon'
  	poolDictionaries: ''
  	category: 'Morphic-Support'!
  !TransferMorph commentStamp: 'nk 6/16/2003 16:52' prior: 0!
  This is a Morph that is used to visually indicate the progress of a drag operation, and also as a container for various bits of drag state information.
  It polls the shift state in its step method to update its copy state (shift pressed = should copy).
  And if you hit the Escape key while dragging, it aborts the drag operation.!

Item was changed:
  ----- Method: TransferMorph>>delete (in category 'submorphs-add/remove') -----
  	"See also >>justDroppedInto:event:."
- 	accepted ifFalse: [self dropNotifyRecipient ifNotNil: [self dropNotifyRecipient dropRejectedMorph: self]].
  	self changed: #deleted.
  	self breakDependents.
  	super delete!

Item was added:
+ ----- Method: TransferMorph>>wantsToBeDroppedInto: (in category 'dropping/grabbing') -----
+ wantsToBeDroppedInto: aMorph
+ 	^ aMorph isWorldMorph
+ 		ifTrue: [ aMorph hasTransferMorphConverter ]
+ 		ifFalse: [ super wantsToBeDroppedInto: aMorph ]!

Item was added:
+ ----- Method: PasteUpMorph>>hasTransferMorphConverter (in category 'dropping/grabbing') -----
+ hasTransferMorphConverter
+ 	^ self transferMorphConverter ~= #yourself!

Item was added:
+ ----- Method: PasteUpMorph>>morphToDropForTransferMorph: (in category 'dropping/grabbing') -----
+ morphToDropForTransferMorph: aTransferMorph 
+ 	"aTransferMorph has been dragged directly onto the desktop.  TransferMorphs, by nature, are about transferring a 'logical object' from another source. Answer the Morph that should actually be dropped on to the desktop."
+ 	^ self
+ 		perform: self transferMorphConverter
+ 		with: aTransferMorph!

Item was changed:
  ----- Method: TransferMorph>>initialize (in category 'initialization') -----
  	"initialize the state of the receiver"
  	super initialize.
  	self layoutPolicy: TableLayout new.
  	self listDirection: #leftToRight;
  		hResizing: #shrinkWrap;
  		vResizing: #shrinkWrap;
  		layoutInset: 3;
  		wrapCentering: #center;
  		cellPositioning: #leftCenter.
- 	accepted := false.
  	copy := false.
  	self on: #keyStroke send: #keyStroke: to: self!

Item was changed:
  ----- Method: TransferMorph>>justDroppedInto:event: (in category 'dropping/grabbing') -----
  justDroppedInto: targetMorph event: anEvent 
  	"If only world wants this TransferMorph, treat it as unaccepted (see also >>delete)."
+ 	super
+ 		justDroppedInto: targetMorph
+ 		event: anEvent.
+ 	self animationForMoveSuccess: true.
- 	super justDroppedInto: targetMorph event: anEvent.
- 	accepted := targetMorph ~= self world.
- 	self animationForMoveSuccess: accepted.
- 	accepted ifTrue: [self dropNotifyRecipient ifNotNil: [self dropNotifyRecipient dropAcceptedMorph: self from: targetMorph]].
  	self delete!

Item was changed:
  ----- Method: MenuMorph>>addItem: (in category 'construction') -----
  addItem: aBlock
  	| item |
  	item := MenuItemMorph new.
  	aBlock value: item.
+ 	self addMenuItem: item!
- 	self addMorphBack: item!

More information about the Squeak-dev mailing list