Tue, May 1, 2018 at 3:10 PM
To: squeak-dev@lists.squeakfoundation.org
Is there a magic menu item somewhere that I can send a morph to a specific project?
I have that in my muO images (such as the available at http://www.zogotounga.net/comp/squeak/muo/muO335.zip), it is an item from the red halo handle, "send to project..."
The implementation is
Morph>>sendToAnotherProject
| target |
target := Project queryProject ifNil: [^ self].
target world addMorph: self
Project class>>queryProject
| selection nBack prev |
selection := (Project buildJumpToMenu: CustomMenu new) startUpLeftFlush.
selection ifNil: [^ nil].
(selection beginsWith: '%back') ifTrue:
[nBack := (selection copyFrom: 6 to: selection size) asNumber.
prev := CurrentProject previousProject.
1 to: nBack-1 do:
[:i | prev ifNotNil: [prev := prev previousProject]].
prev ifNotNil: [^ prev]].
selection = #parent ifTrue:
[^ CurrentProject parent].
^ Project namedWithDepth: selection.
Project class>>buildJumpToMenu: menu
| listed i toAdd |
listed := OrderedCollection with: CurrentProject.
i := 0.
CurrentProject isTopProject ifFalse:
[self addItem: CurrentProject parent name , ' (parent)'
toMenu: menu
selection: #parent
project: CurrentProject parent.
menu addLine].
(Preferences alphabeticalProjectMenu
ifTrue:
[Project allNamesAndProjects]
ifFalse:
[Project hierarchyOfNamesAndProjects]) do:
[:aPair |
toAdd := aPair last isCurrentProject
ifTrue:
[aPair first, ' (current)']
ifFalse:
[aPair first].
self addItem: toAdd
toMenu: menu
selection: aPair first
project: aPair last].
^ menu
5 Use a specialized morph
DropZoneMorph allows to send a morph to another project.
See also EToyProjectHistoryMorph.
6 Summary / Outlook
Bob Arning
Wed, May 2, 2018 at 10:25 AM
Reply-To: The general-purpose Squeak developers list
To: squeak-dev@lists.squeakfoundation.org
(...) So far we have:
- sending morphs from one project to another
- perhaps selecting the destination based on some morph property
- perhaps the receiving project could refuse to accept the morph
- make the morph frontmost in the receiving project's world, unless that project doesn't even have a world
And other questions occur:
- why limit this to morphs? Why not send arbitrary data from project to project?
- is a morph a ui representation of some separate domain object? Where does the domain object live?
- what if the sending project is in "grid-view mode" and the receiving project is in "list-view mode"? Does sending a specific morph make any sense?
- why assume the morph would be installed in the world at the other end?
- do we assume the morph must be deleted from the sending world? Dropping a morph on a ProjectViewMorph will send a copy to the other project.
This all started with a simple problem that had a simple answer. (...)
DTSTTCPW!