Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1733.mcz ==================== Summary ==================== Name: Morphic-mt.1733 Author: mt Time: 4 March 2021, 3:36:21.510661 pm UUID: 6c985504-3f57-4349-9f09-1476a647e3a3 Ancestors: Morphic-mt.1732 Rudimentary support for dropping source-code artifacts into the world. Just attach #sourceCode as #dragTransferType during a drag operation to trigger the code path. =============== Diff against Morphic-mt.1732 =============== Item was changed: ----- Method: PasteUpMorph>>acceptDroppingMorph:event: (in category 'dropping/grabbing') ----- acceptDroppingMorph: dropped event: evt "The supplied morph, known to be acceptable to the receiver, is now to be assimilated; the precipitating event is supplied" | aMorph | + (self isWorldMorph and: [dropped isTransferMorph]) ifTrue: [ + dropped dragTransferType = #filesAndDirectories + ifTrue: [^ self dropFiles: dropped passenger event: evt]. + dropped dragTransferType = #sourceCode + ifTrue: [^ self dropSourceCode: dropped passenger event: evt]]. - (self isWorldMorph and: - [dropped isTransferMorph and: - [dropped dragTransferType = #filesAndDirectories]]) ifTrue: - [^ self dropFiles: dropped passenger event: evt]. aMorph := self morphToDropFrom: dropped. self isWorldMorph ifFalse: [super acceptDroppingMorph: aMorph event: evt] ifTrue: ["Add the given morph to this world and start stepping it if it wants to be." aMorph isInWorld ifFalse: [aMorph position: evt position]. self addMorphFront: aMorph. (aMorph fullBounds intersects: self viewBox) ifFalse: [Beeper beep. aMorph position: self bounds center]]. aMorph submorphsDo: [:m | (m isKindOf: HaloMorph) ifTrue: [m delete]]. aMorph allMorphsDo: "Establish any penDown morphs in new world" [:m | | tfm mm | m player ifNotNil: [m player getPenDown ifTrue: [((mm := m player costume) notNil and: [(tfm := mm owner transformFrom: self) notNil]) ifTrue: [self noteNewLocation: (tfm localPointToGlobal: mm referencePosition) forPlayer: m player]]]]. self isPartsBin ifTrue: [aMorph isPartsDonor: true. aMorph stopSteppingSelfAndSubmorphs. aMorph suspendEventHandler] ifFalse: [self world startSteppingSubmorphsOf: aMorph]. " self presenter morph: aMorph droppedIntoPasteUpMorph: self." self showingListView ifTrue: [self sortSubmorphsBy: (self valueOfProperty: #sortOrder). self currentWorld abandonAllHalos]. self bringTopmostsToFront.! Item was added: + ----- Method: PasteUpMorph>>dropSourceCode:event: (in category 'event handling') ----- + dropSourceCode: anObject event: evt + + anObject isCompiledMethod + ifTrue: [ + | tool window | + tool := CodeHolder new + setClass: anObject methodClass + selector: anObject selector. + window := ToolBuilder open: tool. + window center: evt position. + window bounds: (window bounds translatedToBeWithin: self bounds)]. + + anObject isString + ifTrue: [anObject edit].! Item was changed: ----- Method: PasteUpMorph>>wantsDroppedTransferMorph: (in category 'dropping/grabbing') ----- wantsDroppedTransferMorph: transferMorph ^ self hasTransferMorphConverter + or: [transferMorph dragTransferType = #filesAndDirectories] + or: [transferMorph dragTransferType = #sourceCode]! - or: [transferMorph dragTransferType = #filesAndDirectories]! |
Free forum by Nabble | Edit this page |