Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-kb.241.mcz ==================== Summary ==================== Name: Morphic-kb.241 Author: kb Time: 20 November 2009, 12:11:21 pm UUID: 0ca38c8f-d991-684e-b25e-3cd6e17ef5a2 Ancestors: Morphic-kb.240 - added preamble to unscubscribe TheWorldMainDockingBar from system change notifications. - added 2px vertical padding to MenuItemMorph in minHeight - refactored the building of TheWorldMainDockingBar - added a stub for Help menu - played a bit with the Windows menu: now you can close a window from there. =============== Diff against Morphic-kb.240 =============== Item was added: + ----- Method: TheWorldMainDockingBar>>newProjectMenuItemsOn: (in category 'submenu - projects') ----- + newProjectMenuItemsOn: menu + + Project allSubclasses do: [ :each | + menu addItem: [ :item | + item + contents: ('New ', each name) translated; + help: ('Start a new ', each name) translated; + action: [ ProjectViewMorph openOn: each new ] ] ]! Item was changed: ----- Method: MenuItemMorph>>subMenuUpdater: (in category 'accessing') ----- subMenuUpdater: aBlock subMenuUpdater := aBlock. + self updateSubMenu. self changed. ! Item was changed: ----- Method: TheWorldMainDockingBar class>>initialize (in category 'class initialization') ----- initialize " self initialize " - SystemChangeNotifier uniqueInstance noMoreNotificationsFor: self. - SystemChangeNotifier uniqueInstance - notify: self - ofSystemChangesOfItem: #method - using: #updateInstances:. - Locale addLocalChangedListener: self. + self updateInstances! - self setTimeStamp! Item was added: + ----- Method: TheWorldMainDockingBar>>windowMenuFor:on: (in category 'submenu - windows') ----- + windowMenuFor: window on: menu + + menu + addItem: [ :item | + item + contents: 'Close'; + action: [ window delete ] ]; + addItem: [ :item | + item + contents: 'Full Screen'; + action: [ window fullScreen ] ]! Item was changed: ----- Method: TheWorldMainDockingBar>>workspaceMenuItemOn: (in category 'submenu - tools') ----- + workspaceMenuItemOn: menu - workspaceMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Workspace' translated; + help: 'Open a Workspace' translated; + icon: (self colorIcon: Preferences workspaceWindowColor); + action: [ StandardToolSet openWorkspace ] ]! - item - contents: 'Workspace'; - help: 'Open a workspace'; - icon: (self colorIcon: Preferences workspaceWindowColor); - action: [ StandardToolSet openWorkspace ]! Item was changed: ----- Method: MenuItemMorph>>minHeight (in category 'layout') ----- minHeight | iconHeight | iconHeight := self hasIcon ifTrue: [self icon height + 2] ifFalse: [0]. + ^(self fontToUse height max: iconHeight) + 2! - ^ self fontToUse height max: iconHeight ! Item was changed: ----- Method: TheWorldMainDockingBar>>transcriptMenuItemOn: (in category 'submenu - tools') ----- + transcriptMenuItemOn: menu - transcriptMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Transcript' translated; + help: 'Open the Transcript' translated; + icon: (self colorIcon: Preferences transcriptWindowColor); + action: [ Transcript open ] ]! - item - contents: 'Transcript'; - help: 'Open the Transcript'; - icon: (self colorIcon: Preferences transcriptWindowColor); - action: [ Transcript open ]! Item was changed: ----- Method: TheWorldMainDockingBar>>loadProjectMenuItemOn: (in category 'submenu - projects') ----- + loadProjectMenuItemOn: menu - loadProjectMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Load Project' translated; + help: 'Load a project from a file' translated; + icon: MenuIcons smallLoadProjectIcon; + action: [ World worldMenu loadProject ] ]! - item - contents: 'Previous Project'; - help: 'Return to the most-recently-visited project'; - icon: MenuIcons smallBackIcon; - action: [ World goBack ]! Item was changed: ----- Method: TheWorldMainDockingBar>>toolsMenuOn: (in category 'construction') ----- toolsMenuOn: aDockingBar aDockingBar addItem: [ :item | item contents: 'Tools' translated; + addSubMenu: [ :menu | + self + browserMenuItemOn: menu; + workspaceMenuItemOn: menu; + transcriptMenuItemOn: menu; + testRunnerMenuItemOn: menu. + menu addLine. + self + monticelloBrowserMenuItemOn: menu; + fileListMenuItemOn: menu ] ]! - addSubMenu: [ :menu | self buildMenu: self toolsMenu on: menu ] ]! Item was changed: ----- Method: TheWorldMainDockingBar>>newProjectMenuItemOn: (in category 'submenu - projects') ----- + newProjectMenuItemOn: menu - newProjectMenuItemOn: item + menu addItem: [ :item | + item + contents: 'New Project' translated; + help: 'Start a new MorphicProject' translated; + icon: MenuIcons smallProjectIcon; + action: [ ProjectViewMorph openOn: MorphicProject new ]; + addSubMenu: [ :subMenu | + self newProjectMenuItemsOn: subMenu ] ]! - item - contents: 'New Project'; - help: 'Start a new project'; - icon: MenuIcons smallProjectIcon; - action: [ MorphicProject openViewOn: nil ]! Item was changed: ----- Method: TheWorldMainDockingBar>>monticelloBrowserMenuItemOn: (in category 'submenu - tools') ----- + monticelloBrowserMenuItemOn: menu - monticelloBrowserMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Monticello Browser' translated; + help: 'Open a Monticello Browser' translated; + icon: (self colorIcon: MCTool basicNew defaultBackgroundColor); + action: [ MCWorkingCopyBrowser open ] ]! - item - contents: 'Monticello Browser'; - help: 'Open a Monticello Browser'; - icon: (self colorIcon: MCTool basicNew defaultBackgroundColor); - action: [ MCWorkingCopyBrowser open ]! Item was changed: Object subclass: #TheWorldMainDockingBar + instanceVariableNames: '' - instanceVariableNames: 'icons' classVariableNames: 'Instance TS' poolDictionaries: '' category: 'Morphic-Kernel'! Item was changed: ----- Method: TheWorldMainDockingBar>>saveAsMenuItemOn: (in category 'submenu - squeak') ----- + saveAsMenuItemOn: menu - saveAsMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Save Image As...' translated; + help: 'Save the current state of Squeak on disk under a new name' translated; + icon: MenuIcons smallSaveAsIcon; + action: [ SmalltalkImage current saveAs ] ]! - item - contents: 'Save Image As...'; - help: 'Save the current state of Squeak on disk under a new name'; - icon: MenuIcons smallSaveAsIcon; - action: [ SmalltalkImage current saveAs ]! Item was changed: ----- Method: MenuItemMorph>>select: (in category 'selecting') ----- select: evt self isSelected: true. self updateSubMenu. owner activeSubmenu: subMenu. subMenu ifNotNil: [ subMenu delete. subMenu popUpAdjacentTo: self adjacentTo forHand: evt hand from: self. subMenu selectItem: nil event: evt].! Item was changed: ----- Method: MenuMorph>>displayFiltered: (in category 'keyboard control') ----- displayFiltered: evt | matchStr allItems isMatch matches feedbackMorph | matchStr := self valueOfProperty: #matchString. allItems := self submorphs select: [:m | m isKindOf: MenuItemMorph]. matches := allItems select: [:m | isMatch := matchStr isEmpty or: [ m contents includesSubstring: matchStr caseSensitive: false]. m isEnabled: isMatch. isMatch]. feedbackMorph := self valueOfProperty: #feedbackMorph. feedbackMorph ifNil: [ feedbackMorph := TextMorph new autoFit: true; color: Color darkGray. self addLine; addMorphBack: feedbackMorph lock. self setProperty: #feedbackMorph toValue: feedbackMorph. self fullBounds. "Lay out for submorph adjacency"]. feedbackMorph contents: '<', matchStr, '>'. matchStr isEmpty ifTrue: [ feedbackMorph delete. self submorphs last delete. self removeProperty: #feedbackMorph]. + "matches size >= 1 ifTrue: [ + self selectItem: matches first event: evt]"! - matches size >= 1 ifTrue: [ - self selectItem: matches first event: evt] - ! Item was changed: ----- Method: TheWorldMainDockingBar>>projectsMenuOn: (in category 'construction') ----- projectsMenuOn: aDockingBar aDockingBar addItem: [ :item | item contents: 'Projects' translated; + addSubMenu: [ :menu | + self + newProjectMenuItemOn: menu; + saveProjectMenuItemOn: menu; + loadProjectMenuItemOn: menu; + previousProjectMenuItemOn: menu; + jumpToProjectMenuItemOn: menu ] ] - addSubMenu: [ :menu | self buildMenu: self projectsMenu on: menu ] ] ! Item was changed: ----- Method: TheWorldMainDockingBar>>jumpToProjectMenuItemOn: (in category 'submenu - projects') ----- + jumpToProjectMenuItemOn: menu - jumpToProjectMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Jump To Project' translated; + icon: MenuIcons smallForwardIcon; + subMenuUpdater: [ :subMenu | + subMenu defaultTarget: Project. + Project buildJumpToMenu: subMenu ] ]! - item - contents: 'Jump To Project'; - icon: MenuIcons smallForwardIcon; - subMenuUpdater: [ :menu | - menu defaultTarget: Project. - Project buildJumpToMenu: menu ]! Item was changed: ----- Method: TheWorldMainDockingBar>>quitMenuItemOn: (in category 'submenu - squeak') ----- + quitMenuItemOn: menu - quitMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Quit' translated; + help: 'Quit out of Squeak' translated; + icon: MenuIcons smallQuitIcon; + action: [ + SmalltalkImage current + snapshot: ( + self + confirm: 'Save changes before quitting?' translated + orCancel: [ ^self ]) + andQuit: true ] ]! - item - contents: 'Quit'; - help: 'Quit out of Squeak'; - icon: MenuIcons smallQuitIcon; - action: [ - SmalltalkImage current - snapshot: ( - self - confirm: 'Save changes before quitting?' translated - orCancel: [ ^self ]) - andQuit: true ]! Item was changed: ----- Method: TheWorldMainDockingBar>>saveMenuItemOn: (in category 'submenu - squeak') ----- + saveMenuItemOn: menu - saveMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Save Image' translated; + help: 'Save the current state of Squeak on disk' translated; + icon: MenuIcons smallSaveIcon; + action: [ SmalltalkImage current snapshot: true andQuit: false ] ]! - item - contents: 'Save Image'; - help: 'Save the current state of Squeak on disk'; - icon: MenuIcons smallSaveIcon; - action: [ SmalltalkImage current snapshot: true andQuit: false ]! Item was added: + ----- Method: TheWorldMainDockingBar>>menusOn: (in category 'construction') ----- + menusOn: aDockingBar + + self + squeakMenuOn: aDockingBar; + projectsMenuOn: aDockingBar; + toolsMenuOn: aDockingBar; + windowsMenuOn: aDockingBar; + helpMenuOn: aDockingBar! Item was changed: ----- Method: TheWorldMainDockingBar>>saveProjectMenuItemOn: (in category 'submenu - projects') ----- + saveProjectMenuItemOn: menu - saveProjectMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Save Project' translated; + help: 'Save this project on a file' translated; + icon: MenuIcons smallPublishIcon; + action: [ World saveOnFile ] ]! - item - contents: 'Save Project'; - help: 'Save this project on a file'; - icon: MenuIcons smallPublishIcon; - action: [ World saveOnFile ]! Item was changed: ----- Method: TheWorldMainDockingBar>>testRunnerMenuItemOn: (in category 'submenu - tools') ----- + testRunnerMenuItemOn: menu - testRunnerMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Test Runner' translated; + help: 'Open the Test Runner' translated; + icon: (self colorIcon: TestRunner basicNew defaultBackgroundColor); + action: [ TestRunner open ] ]! - item - contents: 'Test Runner'; - help: 'Open the Test Runner'; - icon: (self colorIcon: Preferences testRunnerWindowColor); - action: [ TestRunner open ]! Item was changed: ----- Method: TheWorldMainDockingBar>>squeakMenuOn: (in category 'construction') ----- squeakMenuOn: aDockingBar "Private - fill the given docking bar" aDockingBar addItem: [ :item | item contents: ''; icon: MenuIcons squeakLogoIcon; selectedIcon: MenuIcons squeakLogoInvertedIcon; + addSubMenu: [ :menu | + self + aboutMenuItemOn: menu; + updateMenuItemOn: menu. + menu addLine. + self + saveMenuItemOn: menu; + saveAsMenuItemOn: menu; + saveAsNewVersionMenuItemOn: menu. + menu addLine. + self + saveAndQuitMenuItemOn: menu; + quitMenuItemOn: menu ] ]! - addSubMenu: [ :menu | self buildMenu: self squeakMenu on: menu ] ]! Item was changed: ----- Method: TheWorldMainDockingBar>>updateMenuItemOn: (in category 'submenu - squeak') ----- + updateMenuItemOn: menu - updateMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Update Squeak' translated; + help: 'Load latest code updates via the internet' translated; + action: [ Utilities updateFromServer ] ]! - item - contents: 'Update Squeak'; - help: 'Load latest code updates via the internet'; - action: [ Utilities updateFromServer ]! Item was changed: ----- Method: TheWorldMainDockingBar>>saveAsNewVersionMenuItemOn: (in category 'submenu - squeak') ----- + saveAsNewVersionMenuItemOn: menu - saveAsNewVersionMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Save As New Version' translated; + help: 'Save the current state of Squeak on disk under a version-stamped name' translated; + icon: MenuIcons smallSaveAsIcon; + action: [ SmalltalkImage current saveAsNewVersion ] ]! - item - contents: 'Save As New Version'; - help: 'Save the current state of Squeak on disk under a version-stamped name'; - icon: MenuIcons smallSaveAsIcon; - action: [ SmalltalkImage current saveAsNewVersion ]! Item was changed: ----- Method: TheWorldMainDockingBar>>aboutMenuItemOn: (in category 'submenu - squeak') ----- + aboutMenuItemOn: menu - aboutMenuItemOn: item + menu addItem: [ :item | + item + contents: 'About Squeak...' translated; + action: [ ] ]! - item - contents: 'About Squeak...' translated; - action: [ ]! Item was changed: ----- Method: TheWorldMainDockingBar>>windowsMenuOn: (in category 'construction') ----- windowsMenuOn: aDockingBar aDockingBar addItem: [ :item | item contents: 'Windows' translated; + subMenuUpdater: [ :menu | + self listWindowsOn: menu ] ] - subMenuUpdater: [ :menu | self listWindowsOn: menu ] ] ! Item was changed: ----- Method: TheWorldMainDockingBar>>saveAndQuitMenuItemOn: (in category 'submenu - squeak') ----- + saveAndQuitMenuItemOn: menu - saveAndQuitMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Save And Quit' translated; + help: 'Save the current state of Squeak on disk, and quit out of Squeak' translated; + icon: MenuIcons smallQuitIcon; + action: [ SmalltalkImage current snapshot: true andQuit: true ] ]! - item - contents: 'Save And Quit'; - help: 'Save the current state of Squeak on disk, and quit out of Squeak'; - icon: MenuIcons smallQuitIcon; - action: [ SmalltalkImage current snapshot: true andQuit: true ]! Item was added: + ----- Method: TheWorldMainDockingBar>>previousProjectMenuItemOn: (in category 'submenu - projects') ----- + previousProjectMenuItemOn: menu + + menu addItem: [ :item | + item + contents: 'Previous Project' translated; + help: 'Return to the most-recently-visited project' translated; + icon: MenuIcons smallBackIcon; + action: [ World goBack ] ]! Item was changed: ----- Method: TheWorldMainDockingBar>>browserMenuItemOn: (in category 'submenu - tools') ----- + browserMenuItemOn: menu - browserMenuItemOn: item + menu addItem: [ :item | + item + contents: 'Browser' translated; + help: 'Open a browser' translated; + icon: (self colorIcon: Preferences browserWindowColor); + action: [ StandardToolSet openClassBrowser ] ]! - item - contents: 'Browser'; - help: 'Open a browser'; - icon: (self colorIcon: Preferences browserWindowColor); - action: [ StandardToolSet openClassBrowser ]! Item was added: + ----- Method: TheWorldMainDockingBar>>helpMenuOn: (in category 'construction') ----- + helpMenuOn: aDockingBar + + aDockingBar addItem: [ :item | + item + contents: 'Help' translated; + help: 'Todo' ]! Item was changed: ----- Method: TheWorldMainDockingBar>>fileListMenuItemOn: (in category 'submenu - tools') ----- + fileListMenuItemOn: menu - fileListMenuItemOn: item + menu addItem: [ :item | + item + contents: 'File List' translated; + help: 'Open a file list' translated; + icon: (self colorIcon: Preferences fileListWindowColor); + action: [ StandardToolSet openFileList ] ]! - item - contents: 'File List'; - help: 'Open a file list'; - icon: (self colorIcon: Preferences fileListWindowColor); - action: [ StandardToolSet openFileList ]! Item was changed: ----- Method: TheWorldMainDockingBar>>fillDockingBar: (in category 'construction') ----- fillDockingBar: aDockingBar "Private - fill the given docking bar" aDockingBar addSpace: 6. + self menusOn: aDockingBar. - self - squeakMenuOn: aDockingBar; - toolsMenuOn: aDockingBar; - projectsMenuOn: aDockingBar; - windowsMenuOn: aDockingBar. aDockingBar setProperty: #mainDockingBarTimeStamp toValue: self class timeStamp! Item was changed: + ----- Method: TheWorldMainDockingBar>>listWindowsOn: (in category 'submenu - windows') ----- - ----- Method: TheWorldMainDockingBar>>listWindowsOn: (in category 'construction') ----- listWindowsOn: menu | expanded | expanded := SystemWindow windowsIn: World satisfying: [ :w | w isCollapsed not ]. expanded ifEmpty: [ menu addItem: [ :item | item contents: 'No open Windows' translated; isEnabled: false; action: [ ] ] ]. expanded do: [ :each | menu addItem: [ :item | item contents: each label; icon: (self colorIcon: each paneColor); + subMenuUpdater: [ :subMenu | self windowMenuFor: each on: subMenu ]; action: [ each activateAndForceLabelToShow ] ] ].! Item was changed: Item was removed: - ----- Method: TheWorldMainDockingBar>>buildMenuItem:on: (in category 'private') ----- - buildMenuItem: aString on: menu - - aString first = $= ifTrue: [ ^menu addLine ]. - menu addItem: [ :item | - self perform: (aString, 'MenuItemOn:') asSymbol with: item ]. - ! Item was removed: - ----- Method: TheWorldMainDockingBar>>buildMenu:on: (in category 'private') ----- - buildMenu: description on: menu - - menu defaultTarget: self. - description do: [ :each | - self buildMenuItem: each on: menu ]! Item was removed: - ----- Method: TheWorldMainDockingBar>>squeakMenu (in category 'construction') ----- - squeakMenu - - ^#( - 'about' - 'update' - '===' - 'save' - 'saveAs' - 'saveAsNewVersion' - '===' - 'saveAndQuit' - 'quit')! Item was removed: - ----- Method: TheWorldMainDockingBar>>projectsMenu (in category 'construction') ----- - projectsMenu - - ^#( 'newProject' - 'saveProject' - 'loadProject' - 'jumpToProject')! Item was removed: - ----- Method: TheWorldMainDockingBar>>toolsMenu (in category 'construction') ----- - toolsMenu - - ^#( - 'browser' - 'workspace' - 'transcript' - 'testRunner' - '===' - 'monticelloBrowser' - 'fileList')! |
Free forum by Nabble | Edit this page |