[squeak-dev] The Trunk: Morphic-ar.172.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] The Trunk: Morphic-ar.172.mcz

commits-2
Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ar.172.mcz

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

Name: Morphic-ar.172
Author: ar
Time: 7 September 2009, 3:06:57 am
UUID: 5f538727-0023-504a-af0e-c3478d31fed6
Ancestors: Morphic-ar.171

Fix users of CustomMenu in Morphic and replace them with proper MenuMorph usage.

=============== Diff against Morphic-ar.171 ===============

Item was changed:
  ----- Method: Morph>>sightWorldTargets: (in category 'meta-actions') -----
  sightWorldTargets: event
  "Return the potential targets for the receiver.  
  This is derived from Morph>>potentialEmbeddingTargets."
+ | bullseye myWorld candidates choice |
+ myWorld := self world ifNil: [^ #()].
- | bullseye myWorld |
- myWorld := self world
- ifNil: [^ #()].
  bullseye := Point fromUserWithCursor: Cursor target.
+ candidates := myWorld morphsAt: bullseye.
+ choice := UIManager default
+ chooseFrom: (candidates collect:[:m| m knownName ifNil:[m class name]])
+ values: candidates.
+ choice ifNotNil:[self target: choice].!
- self targetFromMenu: ( myWorld morphsAt: bullseye) asKnownNameMenu popupAt: bullseye!

Item was changed:
  ----- Method: TheWorldMenu>>projectThumbnail (in category 'action') -----
  projectThumbnail
  "Offer the user a menu of project names. Attach to the hand a thumbnail of the project the user selects."
 
+ | projName pr names values |
+ names := OrderedCollection with: Project current name, ' (current)'.
+ values := OrderedCollection with: Project current name.
+ Project allNames do: [:n | names add: n. values add: n].
+ projName := UIManager default
+ chooseFrom: names values: values lines: #(1) title: 'Select a project'.
- | menu projName pr |
- menu := CustomMenu new.
- menu
- add: (Project current name, ' (current)')
- action: Project current name.
- menu addLine.
- Project allNames do: [:n | menu add: n action: n].
- projName := menu startUpWithCaption: 'Select a project'.
  projName ifNotNil:
  [(pr := Project named: projName)
  ifNotNil: [myHand attachMorph: (ProjectViewMorph on: pr)]
  ifNil: [self inform: 'can''t seem to find that project']].!

Item was changed:
  ----- Method: Morph>>sightTargets: (in category 'meta-actions') -----
  sightTargets: event
  "Return the potential targets for the receiver.  
  This is derived from Morph>>potentialEmbeddingTargets."
+ | bullseye candidates choice |
+ owner ifNil: [^ #()].
- | bullseye |
- owner
- ifNil: [^ #()].
  bullseye := Point fromUserWithCursor: Cursor target.
+ candidates := self potentialTargetsAt: bullseye.
+ choice := UIManager default
+ chooseFrom: (candidates collect:[:m| m knownName ifNil:[m class name]])
+ values: candidates.
+ choice ifNotNil:[self target: choice].!
- self targetFromMenu: (self potentialTargetsAt: bullseye) asKnownNameMenu popupAt: bullseye!

Item was changed:
  ----- Method: ProjectViewMorph>>showMenuForProjectView (in category 'events') -----
  showMenuForProjectView
+ | menu |
+ (menu := MenuMorph new)
- | menu selection |
- (menu := CustomMenu new)
  add: 'enter this project' translated
  action: [^ self enter];
 
  add: 'ENTER ACTIVE' translated
  action: [self setProperty: #wasOpenedAsSubproject toValue: true.
  ^ self enterAsActiveSubproject];
 
  add: 'PUBLISH (also saves a local copy)' translated
  action: [^ project storeOnServerShowProgressOn: self forgetURL: false];
 
  add: 'PUBLISH to a different server' translated
  action: [project forgetExistingURL.
  ^ project storeOnServerShowProgressOn: self forgetURL: true];
 
  add: 'see if server version is more recent' translated
  action: [^ self checkForNewerVersionAndLoad];
 
  addLine;
  add: 'expunge this project' translated
  action: [^ self expungeProject].
 
+ menu title: ('Project Named \"{1}"' translated withCRs format: {project name}).
+ menu invokeModal.!
- selection := menu build startUpCenteredWithCaption:
- ('Project Named \"{1}"' translated withCRs format: {project name}).
-
- selection
- ifNil: [^ self].
- selection value!

Item was changed:
  ----- Method: MenuMorph>>add:action: (in category 'construction') -----
+ add: aString action: aSymbolOrValuable
- add: aString action: aSymbol
  "Append a menu item with the given label. If the item is selected, it will send the given selector to the default target object."
  "Details: Note that the menu item added captures the default target object at the time the item is added; the default target can later be changed before added additional items without affecting the targets of previously added entries. The model is that each entry is like a button that knows everything it needs to perform its action."
+ aSymbolOrValuable isSymbol ifTrue:[
+ self add: aString
+ target: defaultTarget
+ selector: aSymbolOrValuable
+ argumentList: EmptyArray.
+ ] ifFalse:[
+ self add: aString
+ target: aSymbolOrValuable
+ selector: #value
+ argumentList: EmptyArray.
+ ]
-
- self add: aString
- target: defaultTarget
- selector: aSymbol
- argumentList: EmptyArray.
  !

Item was removed:
- ----- Method: Collection>>asKnownNameMenu (in category '*Morphic-objectMenu') -----
- asKnownNameMenu
- "Return a menu to select an element of the collection.  
- Menu uses the knownName or class name as only description of  
- element."
- | menu |
- menu := CustomMenu new.
- self
- do: [:m | menu
- add: (m knownName
- ifNil: [m class name asString])
- action: m].
- ^ menu!

Item was removed:
- ----- Method: Morph>>targetFromMenu:popupAt: (in category 'meta-actions') -----
- targetFromMenu: aMenu popupAt: aPoint
- "Some other morph become target of the receiver"
- | newTarget |
- newTarget := aMenu startUpWithCaption: self externalName , ' targets... '
- at: aPoint .
- "self halt ."
- newTarget
- ifNil: [^ self].
- self target: newTarget!