'From Pharo1.3a of ''18 January 2011'' [Latest update: #13065] on 25 February 2011 at 6:48:36 pm'! !UpdatingStringMorph methodsFor: 'editing' stamp: 'StephaneDucasse 2/25/2011 18:26'! setPrecision "Allow the user to specify a number of decimal places. This UI is invoked from a menu. Nowadays the precision can be set by simple type-in, making this menu approach mostly obsolete. However, it's still useful for read-only readouts, where type-in is not allowed." | aMenu | aMenu := UIManager default newMenuIn: self for: self. aMenu addTitle: ('How many decimal places? (currently {1})' translated format: {self decimalPlaces}). 0 to: 5 do: [:places | aMenu add: places asString target: self selector: #setDecimalPlaces: argument: places]. aMenu popUpInWorld! ! !FileList methodsFor: 'private' stamp: 'StephaneDucasse 2/25/2011 18:42'! selectEncoding "self new selectEncoding" | aMenu | aMenu := UIManager default newMenuIn: self for: self. TextConverter allSubclasses do: [:each | | names | names := each encodingNames. names notEmpty ifTrue: [ | label | label := '' writeStream. names do: [:eachName | label nextPutAll: eachName ] separatedBy: [ label nextPutAll: ', ']. aMenu add: label contents action: names first asSymbol. ]. ]. aMenu popUpInWorld ! ! !UIManager methodsFor: 'ui requests' stamp: 'StephaneDucasse 2/25/2011 18:44'! newMenuIn: aThemedMorph for: aModel "Answer a new menu." ^ self subclassResponsibility! ! !WorldState methodsFor: 'worldmenu building' stamp: 'StephaneDucasse 2/25/2011 17:58'! fallbackWorldMenu "Build the menu that is put up if something is going wrong with the menubuilder" | menu | menu := UIManager default newMenuIn: self world for: self. menu commandKeyHandler: self. menu addTitle: 'Fallback world menu'. menu addStayUpItem. menu add: 'Why you see this menu' target: self selector: #fallbackMenuExplanations. menu addLine. menu defaultTarget: ToolSet default; addList: ToolSet default mainMenuItems. menu addLine. menu add: 'Save' target: Smalltalk selector: #saveSession. menu add: 'Save as...' target: self class selector: #saveAs. menu add: 'Save and quit' target: Smalltalk selector: #snapshot:andQuit: argumentList: {true. true}. menu add: 'Quit' target: self class selector: #quitSession. ^ menu! ! !HostSystemMenusMacOSX methodsFor: 'building-menus' stamp: 'StephaneDucasse 2/25/2011 18:48'! openMenu "Build the open window menu for the world." | menu | menu := UIManager default newMenuIn: self for: ToolSet default. menu addList: ToolSet menuItems. ^menu! ! !Workspace methodsFor: 'drag and drop' stamp: 'StephaneDucasse 2/25/2011 18:02'! shiftedYellowButtonMenu "Answer the menu to be presented when the yellow button is pressed while the shift key is down" ^ (UIManager default newMenuIn: textMorph for: self) addList: { {'Browse it (b)' translated. #browseIt}. {'Senders of it (n)' translated. #sendersOfIt}. {'Implementors of it (m)' translated. #implementorsOfIt}. {'References to it (N)' translated. #referencesToIt}. #-. {'Selectors containing it (W)' translated. #methodNamesContainingIt}. {'Method strings with it (E)' translated. #methodStringsContainingit}. {'Method source with it' translated. #methodSourceContainingIt}. {'Class names containing it' translated. #classNamesContainingIt}. {'Class comments with it' translated. #classCommentsContainingIt}. {'Change sets with it' translated. #browseChangeSetsWithSelector}. " #-. {'Pretty print' translated. #prettyPrint}. {'Pretty print with color' translated. #prettyPrintWithColor}. {'File it in (G)' translated. #fileItIn}. #-. {'Back...' translated. #yellowButtonActivity}. " } ! ! !Workspace methodsFor: 'drag and drop' stamp: 'StephaneDucasse 2/25/2011 18:05'! yellowButtonMenu ^ (UIManager default newMenuIn: textMorph for: self) addList: { {'Do it (d)' translated. #doIt. nil. #smallDoItIcon}. {'Print it (p)' translated. #printIt. nil. #smallPrintIcon}. {'Inspect it (i)' translated. #inspectIt. nil. #smallInspectItIcon}. {'Explore it (I)' translated. #exploreIt. nil. #smallInspectItIcon}. {'Debug it (D)' translated. #debugIt. nil. #smallDebugItIcon}. {'Profile it' translated. #tallyIt}. {'Watch it' translated. #watchIt}. #-. {'Find...(f)' translated. #find. nil. #smallFindIcon}. {'Find again (g)' translated. #findAgain.nil. #smallFindIcon}. {'Extended search...' translated. #shiftedTextPaneMenuRequest}. #-. {'Do again (j)' translated. #again. nil. #smallDoItIcon}. {'Undo (z)' translated. #undo. nil. #smallUndocon}. #-. {'Copy (c)' translated. #copySelection. nil. #smallCopyIcon}. {'Cut (x)' translated. #cut. nil. #smallCutIcon}. {'Paste (v)' translated. #paste. nil. #smallPasteIcon}. {'Paste...' translated. #pasteRecent. nil. #smallCopyIcon}. #-. {'Accept (s)' translated. #accept. nil. #smallOkIcon}. {'Cancel (l)' translated. #cancel. nil. #smallCancelIcon}. }. ! ! !MorphicUIManager methodsFor: 'ui requests' stamp: 'StephaneDucasse 2/25/2011 17:53'! newMenuIn: aThemedMorph for: aModel "Answer a new menu." "UIManager default" ^self theme newMenuIn: aThemedMorph for: aModel! ! !MorphicUIManager methodsFor: 'ui requests' stamp: 'StephaneDucasse 2/25/2011 17:53'! theme "Return the current theme" ^ UITheme current ! ! !MCConfigurationBrowser methodsFor: 'actions' stamp: 'StephaneDucasse 2/25/2011 18:45'! updateMenu | menu | menu := UIManager default newMenuIn: self for: self. menu add: 'update from image' action: #updateFromImage. menu add: 'update from repositories' action: #updateFromRepositories. menu popUpInWorld.! ! !BorderedMorph methodsFor: 'menu' stamp: 'StephaneDucasse 2/25/2011 18:34'! addBorderStyleMenuItems: aMenu hand: aHandMorph "Add border-style menu items" | subMenu | subMenu := UIManager default newMenuIn: self for: self. subMenu addStayUpItemSpecial. subMenu addList: {{'border color...' translated. #changeBorderColor:}. {'border width...' translated. #changeBorderWidth:}}. subMenu addLine. BorderStyle borderStyleChoices do: [:sym | (self borderStyleForSymbol: sym) ifNotNil: [subMenu add: sym translated target: self selector: #setBorderStyle: argument: sym]]. aMenu add: 'border style' translated subMenu: subMenu ! ! !CollapsedMorph methodsFor: 'menu' stamp: 'StephaneDucasse 2/25/2011 18:42'! buildWindowMenu "Answer the menu to be put up in response to the user's clicking on the window-menu control in the window title. Specialized for CollapsedMorphs." | aMenu | aMenu := UIManager default newMenuIn: self for: self. aMenu add: 'Change name...' translated action: #relabel. aMenu addLine. aMenu add: 'Send to back' translated action: #sendToBack. aMenu add: 'Make next-to-topmost' translated action: #makeSecondTopmost. aMenu addLine. self mustNotClose ifFalse: [aMenu add: 'Make unclosable' translated action: #makeUnclosable] ifTrue: [aMenu add: 'Make closable' translated action: #makeClosable]. aMenu add: (self isSticky ifTrue: ['Make draggable'] ifFalse: ['Make undraggable']) translated action: #toggleStickiness. ^aMenu! ! !CPUWatcher methodsFor: 'porcine capture' stamp: 'StephaneDucasse 2/25/2011 18:37'! openMorphicWindowForSuspendedProcess: aProcess | menu rules | menu := UIManager default newMenuIn: self for: self. "nickname allow-stop allow-debug" rules := ProcessBrowser nameAndRulesFor: aProcess. menu add: 'Dismiss this menu' target: menu selector: #delete; addLine. menu add: 'Open Process Browser' target: ProcessBrowser selector: #open. menu add: 'Resume' target: self selector: #resumeProcess:fromMenu: argumentList: { aProcess . menu }. menu add: 'Terminate' target: self selector: #terminateProcess:fromMenu: argumentList: { aProcess . menu }. rules third ifTrue: [ menu add: 'Debug at a lower priority' target: self selector: #debugProcess:fromMenu: argumentList: { aProcess . menu }. ]. menu addTitle: aProcess identityHash asString, ' ', rules first, ' is taking too much time and has been suspended. What do you want to do with it?'. menu stayUp: true. menu popUpInWorld ! ! !CodeHolder methodsFor: 'commands' stamp: 'StephaneDucasse 2/25/2011 18:40'! copyUpOrCopyDown "Used to copy down code from a superclass to a subclass or vice-versa in one easy step, if you know what you're doing. Prompt the user for which class to copy down or copy up to, then spawn a fresh browser for that class, with the existing code planted in it, and with the existing method category also established." | aClass aSelector allClasses implementors aMenu | ((aClass := self selectedClassOrMetaClass) isNil or: [(aSelector := self selectedMessageName) == nil]) ifTrue: [^ Beeper beep]. allClasses := self systemNavigation hierarchyOfClassesSurrounding: aClass. implementors := self systemNavigation hierarchyOfImplementorsOf: aSelector forClass: aClass. aMenu := UIManager default newMenuIn: self for: self. aMenu title: aClass name, '.', aSelector, ' Choose where to insert a copy of this method (blue = current, black = available, red = other implementors'. allClasses do: [:cl | | aColor | aColor := cl == aClass ifTrue: [#blue] ifFalse: [(implementors includes: cl) ifTrue: [#red] ifFalse: [#black]]. (aColor == #red) ifFalse: [aMenu add: cl name selector: #spawnToClass: argument: cl] ifTrue: [aMenu add: cl name selector: #spawnToCollidingClass: argument: cl]. aMenu lastItem color: (Color colorFrom: aColor)]. aMenu popUpInWorld! !