[squeak-dev] How do I move a morph from one project to another?

Bob Arning arning315 at comcast.net
Thu May 3 14:26:23 UTC 2018


As karl mentioned, there is such a thing, but perhaps specialization is 
useful. Attached is an update to DropZoneMorph which can create drop 
zones (with thumbnail) for all morphic projects, with the extra feature 
that dropped morphs are centered in the destination world to make them 
easy to find.

Also, it's not just top-level morphs -- here is a class list from a 
browser dropped into a different project:


On 5/3/18 9:50 AM, Eliot Miranda wrote:
>
> On May 2, 2018, at 5:09 AM, Bob Arning <arning315 at comcast.net 
> <mailto:arning315 at comcast.net>> wrote:
>
>> In the course of this discussion, it seemed like drag&drop might be 
>> handy for some use cases. Attached is a (really simple) DropZoneMorph 
>> that can do whatever you like to things dropped into it.
>>
>
> Yes, I like drag & drop too.  But I would like to be able to drag&drop 
> onto the project morph itself. That way we could provide a "projects" 
> morph that showed all the projects in the system, and allow selecting 
> the morph thumbnails one sees in each project morph, and then be able 
> to directly manipulate and drag any top-level morph from any project 
> to any other.  Given a multiple selection convention we could batch, 
> although in my own use I typically only need to move one of two morphs.
>>
>>
>> On 5/2/18 5:48 AM, H. Hirzel wrote:
>>> Bob, thank you for the good summary of the points of discussion.
>>> I work in a similar way as Stéphane describes.
>>>
>>> --Hannes
>>>
>>> On 5/2/18, Stéphane Rollandin<lecteur at zogotounga.net>  wrote:
>>>>> This all started with a simple problem that had a simple answer. Then
>>>>> many answers appeared without a clear notion of what the problem is. Who
>>>>> has a real problem that happens several times a day that takes too long
>>>>> to do? DTSTTCPW, anyone?
>>>> I use projects mostly as virtual desktops where I keep different aspects
>>>> of my work (be it development or music composition) more or less cleanly
>>>> separated.
>>>>
>>>> When I realize that what I'm working on is not anymore in the meant
>>>> scope of the current project, I create a new project and dispatch all
>>>> workspaces, browsers and other tools (including homemade ones such as
>>>> musical editors) that live in the current (usually crowded) World to the
>>>> world of that project.
>>>>
>>>> So I only deal with top-level morphs, and as I said earlier I added an
>>>> item in their red handle menu to easily send them away (usually several
>>>> morphs in a row). I also have another item for sending a morph copy to
>>>> another project, but I use this one much less often.
>>>>
>>>>
>>>> Stef
>>>>
>>>>
>>
>> <DropZone.02May0805.cs>
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180503/2d4bdf4c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pidabphfippdjpmo.png
Type: image/png
Size: 27922 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180503/2d4bdf4c/attachment-0001.png>
-------------- next part --------------
'From Squeak5.1 of 23 August 2016 [latest update: #16548] on 3 May 2018 at 10:15:24 am'!
"Change Set:		DropZone
Date:			2 May 2018
Author:			Bob Arning

DropZoneMorph is a place to drop things to execute a user-supplied action. Examples in class comment"!

Morph subclass: #DropZoneMorph
	instanceVariableNames: 'label action '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-Widgets'!

!DropZoneMorph commentStamp: 'raa 5/3/2018 10:11' prior: 0!
DropZoneMorph new 
	openLabel: 'explore' 
	action: [ :m | m explore. #reject]

DropZoneMorph new 
	openLabel: 'to project unnamed' 
	action: [ :m | (Project named: 'Unnamed') world addMorph: m.]
	
DropZoneMorph new 
	openLabel: 'take a picture' 
	action: [ :m | m imageForm asMorph openInWorld. #reject];
	addMorphBack: (Morph new color: Color green)
	
DropZoneMorph makeAllProjectsDropper!
]style[(367 22),c000126126!


!DropZoneMorph methodsFor: 'as yet unclassified' stamp: 'raa 5/2/2018 07:31'!
acceptDroppingMorph: aMorph event: evt

	self halt.! !

!DropZoneMorph methodsFor: 'as yet unclassified' stamp: 'raa 5/2/2018 11:55'!
openLabel: l action: a

	label _ l.
	action _ a.
	self
		layoutPolicy: TableLayout new;
		rubberBandCells: true;
		listDirection: #topToBottom;
		hResizing: #shrinkWrap;
		vResizing: #shrinkWrap;
		extent: 1 at 1;
		borderWidth: 0;
		color: Color paleBlue;
		addMorph: (StringMorph contents: label) lock.
	self openInWorld! !

!DropZoneMorph methodsFor: 'as yet unclassified' stamp: 'raa 5/2/2018 07:58'!
rejectDropEvent: anEvent

	anEvent wasHandled: true.

	(action value: anEvent contents) = #reject ifTrue: [
		anEvent contents rejectDropMorphEvent: anEvent.
	].
! !

!DropZoneMorph methodsFor: 'as yet unclassified' stamp: 'raa 5/2/2018 07:59'!
wantsDroppedMorph: aMorph event: evt

	self halt.

	! !


!DropZoneMorph class methodsFor: 'as yet unclassified' stamp: 'raa 5/3/2018 10:14'!
makeAllProjectsDropper
"
self makeAllProjectsDropper
"
	| wrapper |
	wrapper _ AlignmentMorph newColumn.
	Project allProjects do: [ :p |
		p isMorphic ifTrue: [
			wrapper addMorphBack: (
				DropZoneMorph new 
					openLabel: 'to ',p name 
					action: [ :m | 
						p world addMorph: m.
						m center: p world center	"make new morphs easier to find"
					];
					addMorphBack: (p thumbnail ifNil: [Morph new]) asMorph
			)		
		].
	].
	wrapper openInWorld.! !



More information about the Squeak-dev mailing list