'From etoys2.2 of 24 September 2007 [latest update: #1680] on 3 October 2007 at 12:49:02 am'! "Change Set: worldHaloMenu-sw Date: 3 October 2007 Author: Scott Wallace Harmonize and rationalize the eToyFriendly and non-eToyFriendly versions of the world halo menu. Remove 'layout' from both versions. Some rewording, reordering, refactoring. "! !CurrentProjectRefactoring class methodsFor: 'flaps' stamp: 'sw 10/3/2007 00:07'! showTabsString "Answer a string characterizing whether global flap tabs are showing (true) or suppressed (false)." ^ (self currentFlapsSuppressed ifTrue: [''] ifFalse: ['']), 'show flaps (F)' translated! ! !Morph methodsFor: 'menus' stamp: 'sw 10/2/2007 23:55'! addStandardHaloMenuItemsTo: aMenu hand: aHandMorph "Add standard halo items to the menu. Note -- PasteUpMorphs that are serving as Worlds are handled by a separate protocol." self mustBeBackmost ifFalse: [aMenu add: 'send to back' translated action: #goBehind. aMenu add: 'bring to front' translated action: #comeToFront. aMenu addWithLabel: 'embed...' translated enablement: #embedEnabled action: #showEmbedMenu. aMenu balloonTextForLastItem: 'present a menu of potential embeddeding targets for this object, and embed it in the one chosen.' translated. aMenu addLine]. self addFillStyleMenuItems: aMenu hand: aHandMorph. self addBorderStyleMenuItems: aMenu hand: aHandMorph. self addDropShadowMenuItems: aMenu hand: aHandMorph. Preferences eToyFriendly ifFalse: [self addHaloActionsTo: aMenu. self addLayoutMenuItems: aMenu hand: aHandMorph]. owner isTextMorph ifTrue:[self addTextAnchorMenuItems: aMenu hand: aHandMorph]. aMenu addLine. self addToggleItemsToHaloMenu: aMenu. aMenu addLine. Preferences eToyFriendly ifFalse: [self addCopyItemsTo: aMenu]. self addPlayerItemsTo: aMenu. Preferences eToyFriendly ifFalse: [self addExportMenuItems: aMenu hand: aHandMorph. "self addStackItemsTo: aMenu"]. self addMiscExtrasTo: aMenu. Preferences eToyFriendly ifFalse: [Preferences noviceMode ifFalse: [self addDebuggingItemsTo: aMenu hand: aHandMorph]]. aMenu addLine. self addLockingItemsTo: aMenu. aMenu defaultTarget: aHandMorph ! ! !Morph methodsFor: 'meta-actions' stamp: 'sw 10/2/2007 22:06'! buildHandleMenu: aHand "Build the morph menu for the given morph's halo's menu handle. This menu has two sections. The first section contains commands that are interpreted by the hand; the second contains commands provided by the target morph. This method allows the morph to decide which items should be included in the hand's section of the menu." | menu | self isWorldMorph ifTrue: [^ self buildWorldHaloMenuForHand: aHand]. menu _ MenuMorph new defaultTarget: self. menu addStayUpItem. menu addLine. self addStandardHaloMenuItemsTo: menu hand: aHand. menu defaultTarget: aHand. self addAddHandMenuItemsForHalo: menu hand: aHand. menu defaultTarget: self. self addCustomHaloMenuItems: menu hand: aHand. menu defaultTarget: aHand. ^ menu ! ! !Morph methodsFor: 'menu & halo' stamp: 'sw 10/2/2007 22:56'! addLockingItemsTo: aMenu "Add locking-related items to the given menu. If any items are needed, a line will be added before them, and it is incumbent on the sender to add a line after them, if required." | unlockables | unlockables _ self submorphs select: [:m | m isLocked]. unlockables size = 0 ifTrue: [^ self]. aMenu addLine. unlockables size == 1 ifTrue: [aMenu add: ('unlock "{1}"' translated format:{unlockables first externalName})action: #unlockContents]. unlockables size > 1 ifTrue: [aMenu add: 'unlock all contents' translated action: #unlockContents. aMenu add: 'unlock...' translated action: #unlockOneSubpart].! ! !PasteUpMorph methodsFor: 'menu & halo' stamp: 'sw 10/2/2007 23:44'! addCustomMenuItems: menu hand: aHandMorph "Add morph-specific menu itemns to the menu for the hand" super addCustomMenuItems: menu hand: aHandMorph. self addStackMenuItems: menu hand: aHandMorph. self addPenMenuItems: menu hand: aHandMorph. self addPlayfieldMenuItems: menu hand: aHandMorph. self isWorldMorph ifTrue: [(owner isKindOf: BOBTransformationMorph) ifTrue: [self addScalingMenuItems: menu hand: aHandMorph]. Flaps sharedFlapsAllowed ifTrue: [menu addUpdating: #suppressFlapsString target: CurrentProjectRefactoring action: #currentToggleFlapsSuppressed]. menu addLine. self addWorldHaloMenuItemsTo: menu hand: aHandMorph]! ! !PasteUpMorph methodsFor: 'menu & halo' stamp: 'sw 10/2/2007 21:37'! addPenMenuItems: menu hand: aHandMorph "Add a pen-trails-within submenu to the given menu" menu add: 'pen trails...' translated target: self selector: #putUpPenTrailsSubmenu. menu balloonTextForLastItem: 'its governing pen trails drawn within' translated! ! !PasteUpMorph methodsFor: 'menu & halo' stamp: 'sw 10/2/2007 21:39'! addPenTrailsMenuItemsTo: aMenu "Add items relating to pen trails to aMenu" | oldTarget | oldTarget _ aMenu defaultTarget. aMenu defaultTarget: self. aMenu add: 'clear pen trails' translated action: #clearTurtleTrails. aMenu addLine. aMenu add: 'all pens up' translated action: #liftAllPens. aMenu add: 'all pens down' translated action: #lowerAllPens. aMenu addLine. aMenu add: 'all pens show lines' translated action: #linesForAllPens. aMenu add: 'all pens show arrowheads' translated action: #arrowsForAllPens. aMenu add: 'all pens show arrows' translated action: #linesAndArrowsForAllPens. aMenu add: 'all pens show dots' translated action: #dotsForAllPens. aMenu addLine. aMenu addUpdating: #batchPenTrailsString action: #toggleBatchPenTrails. aMenu balloonTextForLastItem: 'if true, detailed movement of pens between display updates is ignored. Thus multiple line segments drawn within a script may not be seen individually.' translated. aMenu defaultTarget: oldTarget! ! !PasteUpMorph methodsFor: 'menu & halo' stamp: 'sw 10/2/2007 23:42'! addWorldHaloMenuItemsTo: aMenu hand: aHandMorph "Add the standard items to the aMenu which will serve as the World's halo menu." aMenu add: 'about this system...' translated target: SmalltalkImage current selector: #aboutThisSystem. aMenu addLine. aMenu add: 'redraw screen (r)' translated action: #restoreMorphicDisplay. aMenu add: 'preferences...' translated target: Preferences selector: #openPreferencesInspector. aMenu add: 'authoring tools...' translated target: (TheWorldMenu new adaptToWorld: self) selector: #scriptingDo. aMenu addLine. self addWorldToggleItemsToHaloMenu: aMenu. Preferences eToyFriendly ifFalse: [Preferences sugarNavigator ifFalse: [self addExportMenuItems: aMenu hand: aHandMorph]]. self addLockingItemsTo: aMenu. aMenu addLine. self addFillStyleMenuItems: aMenu hand: aHandMorph. self addPenMenuItems: aMenu hand: aHandMorph. self addPlayfieldMenuItems: aMenu hand: aHandMorph. (owner isKindOf: BOBTransformationMorph) ifTrue: "wow, blast from the past" [self addScalingMenuItems: aMenu hand: aHandMorph]. Preferences eToyFriendly ifFalse: [aMenu addLine. aMenu add: 'desktop menu...' translated target: self action: #putUpDesktopMenu:]! ! !PasteUpMorph methodsFor: 'menu & halo' stamp: 'sw 10/3/2007 00:08'! addWorldToggleItemsToHaloMenu: aMenu "Add toggle items for the world to the halo menu" aMenu addUpdating: #showTabsString target: CurrentProjectRefactoring action: #currentToggleFlapsSuppressed! ! !PasteUpMorph methodsFor: 'menu & halo' stamp: 'sw 10/2/2007 23:42'! buildWorldHaloMenuForHand: aHand "Build and answer a menu that will serve as the world's halo menu." | aMenu | aMenu _ MenuMorph new defaultTarget: self. aMenu addStayUpItem. self addWorldHaloMenuItemsTo: aMenu hand: aHand. ^ aMenu ! ! !PasteUpMorph methodsFor: 'menus' stamp: 'sw 10/2/2007 23:06'! addFillStyleMenuItems: aMenu hand: aHand "Add the items for changing the current fill style of the Morph" self isWorldMorph ifFalse: [^ super addFillStyleMenuItems: aMenu hand: aHand]. aMenu add: 'desktop color...' translated action: #presentDesktopColorMenu. aMenu balloonTextForLastItem: 'change the color or pattern of the desktop background that lies behind everything else on the screen.' translated.! ! !PasteUpMorph methodsFor: 'menus' stamp: 'sw 10/2/2007 20:28'! presentDesktopColorMenu "Present the menu that governs the fill style of the squeak desktop." | aMenu | aMenu _ MenuMorph new defaultTarget: self. aMenu title: 'desktop color' translated. self fillStyle addFillStyleMenuItems: aMenu hand: ActiveHand from: self. aMenu addLine. aMenu add: 'solid fill' translated action: #useSolidFill. aMenu add: 'gradient fill' translated action: #useGradientFill. aMenu add: 'bitmap fill' translated action: #useBitmapFill. aMenu add: 'default fill' translated action: #useDefaultFill. aMenu popUpInWorld ! ! PasteUpMorph removeSelector: #addEtoyWorldMorphMenu:hand:! PasteUpMorph removeSelector: #addLockingItemsTo:! PasteUpMorph removeSelector: #titleForExportMenu! PasteUpMorph removeSelector: #titleForFillStyleMenu! Morph removeSelector: #buildWorldHaloMenuForHand:!