[squeak-dev] The Inbox: Morphic-kb.428.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Apr 25 15:11:41 UTC 2010
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-kb.428.mcz
==================== Summary ====================
Name: Morphic-kb.428
Author: kb
Time: 25 April 2010, 5:10:40.092 pm
UUID: a1cf4a4c-027b-4789-919e-dbdca41d10be
Ancestors: Morphic-ar.427
First stab at refactoring TheWorldMainDockingBar to allow external packages to insert new menus, or menu items. We use two pragmas to fill the docking bar.
A method in TheWorldMainDockingBar marked with pragma: <createDockingBarMenuWithPriority: NN> will get a chance to build on the DockingBarMorph, which it gets as its sole argument.
A method in TheWorldMainDockingBar marked with pragma: <fillDockingBarMenu: #MENUNAME priority: NN> will get a chance to build on a menu, which it gets as its sole argument, when someone calls TheWorldMainDockingBar >> fillMenu: menu with: #MENUNAME
Priority controls the order in which these methods are called.
Currently there are three menus filled with this technique: #tools, #extras, #help
So if you want to add a new menu item to the #extras menu from your package, you'll need to create an extension method on TheWorldMainDockingBar containing the pragma <fillDockingBarMenu: #extras priority: 50>, and evaluate [TheWorldMainDockingBar updateInstances]
You can find examples in TheWorldMainDockingBar.
=============== Diff against Morphic-ar.427 ===============
Item was changed:
+ ----- Method: TheWorldMainDockingBar>>toolsMenuOn: (in category 'submenu - tools') -----
- ----- Method: TheWorldMainDockingBar>>toolsMenuOn: (in category 'construction') -----
toolsMenuOn: aDockingBar
+
+ <createDockingBarMenuWithPriority: 30>
-
aDockingBar addItem: [ :item |
item
contents: 'Tools' translated;
addSubMenu: [ :menu |
+ self fillMenu: menu with: #tools ] ]!
- self
- browserMenuItemOn: menu;
- workspaceMenuItemOn: menu;
- transcriptMenuItemOn: menu;
- testRunnerMenuItemOn: menu.
- menu addLine.
- self
- monticelloBrowserMenuItemOn: menu;
- monticelloConfigurationsMenuItemOn: menu;
- simpleChangeSorterMenuItemOn: menu;
- dualChangeSorterMenuItemOn: menu.
- menu addLine.
- self
- processBrowserMenuItemOn: menu;
- preferenceBrowserMenuItemOn: menu;
- fileListMenuItemOn: menu.
- ] ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>displayMenuItemsOn: (in category 'submenu - extras') -----
+ displayMenuItemsOn: menu
+
+ <fillDockingBarMenu: #extras priority: 20>
+ menu addItem: [ :item |
+ item
+ contents: 'Window Colors' translated;
+ help: 'Changes the window color scheme' translated;
+ addSubMenu: [ :submenu | self windowColorsOn: submenu ] ].
+ menu addItem: [ :item |
+ item
+ contents: 'Restore Display (r)' translated;
+ help: 'Redraws the entire display' translated;
+ target: World;
+ selector: #restoreMorphicDisplay ].
+ menu addItem: [ :item |
+ item
+ contents: 'Rebuild Menus' translated;
+ help: 'Rebuilds the menu bar' translated;
+ target: self class;
+ selector: #updateInstances ].!
Item was changed:
+ ----- Method: TheWorldMainDockingBar>>windowColorsOn: (in category 'submenu - extras') -----
- ----- Method: TheWorldMainDockingBar>>windowColorsOn: (in category 'construction') -----
windowColorsOn: menu
menu addItem:[:item|
item
contents: 'Uniform Windows' translated;
help: 'Use uniform window colors' translated;
target: Preferences;
selector: #installUniformWindowColors].
menu addItem:[:item|
item
contents: 'Colorful Windows' translated;
help: 'Use bright window colors' translated;
target: Preferences;
selector: #installBrightWindowColors].
!
Item was changed:
+ ----- Method: TheWorldMainDockingBar>>windowsMenuOn: (in category 'submenu - windows') -----
- ----- Method: TheWorldMainDockingBar>>windowsMenuOn: (in category 'construction') -----
windowsMenuOn: aDockingBar
+
+ <createDockingBarMenuWithPriority: 50>
-
aDockingBar addItem: [ :item |
item
contents: 'Windows' translated;
subMenuUpdater: self
selector: #listWindowsOn: ]
!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>changesMenuItemsOn: (in category 'submenu - extras') -----
+ changesMenuItemsOn: menu
+
+ <fillDockingBarMenu: #extras priority: 10>
+ menu addItem: [ :item |
+ item
+ contents: 'Recover Changes' translated;
+ help: 'Recover changes after a crash' translated;
+ icon: MenuIcons smallHelpIcon;
+ target: ChangeList;
+ selector: #browseRecentLog ].
+ menu addItem: [ :item |
+ item
+ contents: 'Set Author Initials' translated;
+ help: 'Sets the author initials' translated;
+ target: Utilities;
+ selector: #setAuthorInitials ].!
Item was changed:
+ ----- Method: TheWorldMainDockingBar>>extrasMenuOn: (in category 'submenu - extras') -----
- ----- Method: TheWorldMainDockingBar>>extrasMenuOn: (in category 'construction') -----
extrasMenuOn: aDockingBar
+ <createDockingBarMenuWithPriority: 40>
+ aDockingBar addItem: [ :it |
- aDockingBar addItem: [ :it|
it contents: 'Extras' translated;
+ addSubMenu: [ :menu |
+ self fillMenu: menu with: #extras ] ]!
- addSubMenu: [:menu|
- menu addItem:[:item|
- item
- contents: 'Recover Changes' translated;
- help: 'Recover changes after a crash' translated;
- icon: MenuIcons smallHelpIcon;
- target: ChangeList;
- selector: #browseRecentLog].
- menu addLine.
- menu addItem:[:item|
- item
- contents: 'Window Colors' translated;
- help: 'Changes the window color scheme' translated;
- addSubMenu:[:submenu| self windowColorsOn: submenu]].
- menu addItem:[:item|
- item
- contents: 'Set Author Initials' translated;
- help: 'Sets the author initials' translated;
- target: Utilities;
- selector: #setAuthorInitials].
- menu addItem:[:item|
- item
- contents: 'Restore Display (r)' translated;
- help: 'Redraws the entire display' translated;
- target: World;
- selector: #restoreMorphicDisplay].
- menu addItem:[:item|
- item
- contents: 'Rebuild Menus' translated;
- help: 'Rebuilds the menu bar' translated;
- target: TheWorldMainDockingBar;
- selector: #updateInstances].
- menu addLine.
- menu addItem:[:item|
- item
- contents: 'Start Profiler' translated;
- help: 'Starts the profiler' translated;
- target: self;
- selector: #startMessageTally].
- menu addItem:[:item|
- item
- contents: 'Collect Garbage' translated;
- help: 'Run the garbage collector and report space usage' translated;
- target: Utilities;
- selector: #garbageCollectAndReport].
- menu addItem:[:item|
- item
- contents: 'Purge Undo Records' translated;
- help: 'Save space by removing all the undo information remembered in all projects' translated;
- target: CommandHistory;
- selector: #resetAllHistory].
- menu addItem:[:item|
- item
- contents: 'VM statistics' translated;
- help: 'Virtual Machine information' translated;
- target: self;
- selector: #vmStatistics].
- menu addLine.
- menu addItem:[:item|
- item
- contents: 'Graphical Imports' translated;
- help: 'View the global repository called ImageImports; you can easily import external graphics into ImageImports via the FileList' translated;
- target: (Imports default);
- selector: #viewImages].
- menu addItem:[:item|
- item
- contents: 'Standard Graphics Library' translated;
- help: 'Lets you view and change the system''s standard library of graphics' translated;
- target: ScriptingSystem;
- selector: #inspectFormDictionary].
- menu addItem:[:item|
- item
- contents: 'Annotation Setup' translated;
- help: 'Click here to get a little window that will allow you to specify which types of annotations, in which order, you wish to see in the annotation panes of browsers and other tools' translated;
- target: Preferences;
- selector: #editAnnotations].
- ] ]!
Item was changed:
+ ----- Method: TheWorldMainDockingBar>>projectsMenuOn: (in category 'submenu - projects') -----
- ----- Method: TheWorldMainDockingBar>>projectsMenuOn: (in category 'construction') -----
projectsMenuOn: aDockingBar
+
+ <createDockingBarMenuWithPriority: 20>
-
aDockingBar addItem: [ :item |
item
contents: 'Projects' translated;
addSubMenu: [ :menu |
self
newProjectMenuItemOn: menu;
saveProjectMenuItemOn: menu;
loadProjectMenuItemOn: menu;
previousProjectMenuItemOn: menu;
jumpToProjectMenuItemOn: menu ] ]
!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>developerToolMenuItemsOn: (in category 'submenu - tools') -----
+ developerToolMenuItemsOn: menu
+
+ <fillDockingBarMenu: #tools priority: 10>
+ self
+ browserMenuItemOn: menu;
+ workspaceMenuItemOn: menu;
+ transcriptMenuItemOn: menu;
+ testRunnerMenuItemOn: menu!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>graphicsMenuItemsOn: (in category 'submenu - extras') -----
+ graphicsMenuItemsOn: menu
+
+ <fillDockingBarMenu: #extras priority: 40>
+ menu addItem:[:item|
+ item
+ contents: 'Graphical Imports' translated;
+ help: 'View the global repository called ImageImports; you can easily import external graphics into ImageImports via the FileList' translated;
+ target: (Imports default);
+ selector: #viewImages].
+ menu addItem:[:item|
+ item
+ contents: 'Standard Graphics Library' translated;
+ help: 'Lets you view and change the system''s standard library of graphics' translated;
+ target: ScriptingSystem;
+ selector: #inspectFormDictionary].
+ menu addItem:[:item|
+ item
+ contents: 'Annotation Setup' translated;
+ help: 'Click here to get a little window that will allow you to specify which types of annotations, in which order, you wish to see in the annotation panes of browsers and other tools' translated;
+ target: Preferences;
+ selector: #editAnnotations].!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>helpMenuItemsOn: (in category 'submenu - help') -----
+ helpMenuItemsOn: menu
+
+ <fillDockingBarMenu: #help priority: 10>
+ menu addItem: [ :item |
+ item
+ contents: 'Online Resources' translated;
+ help: 'Online resources for Squeak' translated;
+ target: self;
+ icon: MenuIcons smallHelpIcon;
+ selector: #showWelcomeText:label:in:;
+ arguments: {
+ #squeakOnlineResources.
+ 'Squeak Online Resources'.
+ (140 at 140 extent: 560 at 360)
+ }].
+ menu addItem:[:item|
+ item
+ contents: 'Keyboard Shortcuts' translated;
+ help: 'Keyboard bindings used in Squeak' translated;
+ target: Utilities;
+ selector: #openCommandKeyHelp ].
+ menu addItem:[:item|
+ item
+ contents: 'Font Size Summary' translated;
+ help: 'Font size summary from the old Squeak 3.10.2 help menu.' translated;
+ target: TextStyle;
+ selector: #fontSizeSummary ].
+ menu addItem:[:item|
+ item
+ contents: 'Useful Expressions' translated;
+ help: 'Useful expressions from the old Squeak 3.10.2 help menu.' translated;
+ target: Utilities;
+ selector: #openStandardWorkspace ].
+ menu addLine.
+ menu addItem:[:item|
+ item
+ contents: 'Extending the system' translated;
+ help: 'Includes code snippets to evaluate for extending the system' translated;
+ target: self;
+ icon: MenuIcons smallHelpIcon;
+ selector: #showWelcomeText:label:in:;
+ arguments: {
+ #extendingTheSystem.
+ 'How to extend the system'.
+ (140 at 140 extent: 560 at 360)
+ }].
+ menu addLine.
+ menu addItem:[:item|
+ item
+ contents: 'Welcome Workspaces' translated;
+ help: 'The Welcome Workspaces' translated;
+ addSubMenu:[:submenu| self welcomeWorkspacesOn: submenu]].!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>vmMenuItemsOn: (in category 'submenu - extras') -----
+ vmMenuItemsOn: menu
+
+ <fillDockingBarMenu: #extras priority: 30>
+ menu addItem:[:item|
+ item
+ contents: 'Start Profiler' translated;
+ help: 'Starts the profiler' translated;
+ target: self;
+ selector: #startMessageTally].
+ menu addItem:[:item|
+ item
+ contents: 'Collect Garbage' translated;
+ help: 'Run the garbage collector and report space usage' translated;
+ target: Utilities;
+ selector: #garbageCollectAndReport].
+ menu addItem:[:item|
+ item
+ contents: 'Purge Undo Records' translated;
+ help: 'Save space by removing all the undo information remembered in all projects' translated;
+ target: CommandHistory;
+ selector: #resetAllHistory].
+ menu addItem:[:item|
+ item
+ contents: 'VM statistics' translated;
+ help: 'Virtual Machine information' translated;
+ target: self;
+ selector: #vmStatistics]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>fillMenu:with: (in category 'private') -----
+ fillMenu: menu with: menuName
+
+ | priority |
+ priority := nil.
+ (Pragma
+ allNamed: #fillDockingBarMenu:priority:
+ in: self class
+ sortedByArgument: 2) do: [ :pragma |
+ pragma arguments first = menuName ifTrue: [
+ pragma arguments second = priority ifFalse: [ menu addLine ].
+ self perform: pragma selector with: menu ] ].!
Item was changed:
+ ----- Method: TheWorldMainDockingBar>>squeakMenuOn: (in category 'submenu - squeak') -----
- ----- Method: TheWorldMainDockingBar>>squeakMenuOn: (in category 'construction') -----
squeakMenuOn: aDockingBar
"Private - fill the given docking bar"
+ <createDockingBarMenuWithPriority: 10>
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 ] ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>otherToolMenuItemsOn: (in category 'submenu - tools') -----
+ otherToolMenuItemsOn: menu
+
+ <fillDockingBarMenu: #tools priority: 30>
+ self
+ processBrowserMenuItemOn: menu;
+ preferenceBrowserMenuItemOn: menu;
+ fileListMenuItemOn: menu.!
Item was changed:
----- Method: TheWorldMainDockingBar>>helpMenuOn: (in category 'submenu - help') -----
helpMenuOn: aDockingBar
+
+ <createDockingBarMenuWithPriority: 60>
+ aDockingBar addItem: [ :item |
+ item
+ contents: 'Help' translated;
+ addSubMenu: [ :menu |
+ self fillMenu: menu with: #help ] ].!
-
- aDockingBar addItem: [ :it |
- it contents: 'Help' translated;
- addSubMenu: [ :menu | 'Todo'.
- menu addItem:[:item|
- item
- contents: 'Online Resources' translated;
- help: 'Online resources for Squeak' translated;
- target: self;
- icon: MenuIcons smallHelpIcon;
- selector: #showWelcomeText:label:in:;
- arguments: {
- #squeakOnlineResources.
- 'Squeak Online Resources'.
- (140 at 140 extent: 560 at 360)
- }].
- menu addItem:[:item|
- item
- contents: 'Keyboard Shortcuts' translated;
- help: 'Keyboard bindings used in Squeak' translated;
- target: Utilities;
- selector: #openCommandKeyHelp ].
- menu addItem:[:item|
- item
- contents: 'Font Size Summary' translated;
- help: 'Font size summary from the old Squeak 3.10.2 help menu.' translated;
- target: TextStyle;
- selector: #fontSizeSummary ].
- menu addItem:[:item|
- item
- contents: 'Useful Expressions' translated;
- help: 'Useful expressions from the old Squeak 3.10.2 help menu.' translated;
- target: Utilities;
- selector: #openStandardWorkspace ].
- menu addLine.
- menu addItem:[:item|
- item
- contents: 'Extending the system' translated;
- help: 'Includes code snippets to evaluate for extending the system' translated;
- target: self;
- icon: MenuIcons smallHelpIcon;
- selector: #showWelcomeText:label:in:;
- arguments: {
- #extendingTheSystem.
- 'How to extend the system'.
- (140 at 140 extent: 560 at 360)
- }].
- menu addLine.
- menu addItem:[:item|
- item
- contents: 'Welcome Workspaces' translated;
- help: 'The Welcome Workspaces' translated;
- addSubMenu:[:submenu| self welcomeWorkspacesOn: submenu]].
- ]].!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>changeManagementToolMenuItemsOn: (in category 'submenu - tools') -----
+ changeManagementToolMenuItemsOn: menu
+
+ <fillDockingBarMenu: #tools priority: 20>
+ self
+ monticelloBrowserMenuItemOn: menu;
+ monticelloConfigurationsMenuItemOn: menu;
+ simpleChangeSorterMenuItemOn: menu;
+ dualChangeSorterMenuItemOn: menu.!
Item was changed:
----- Method: TheWorldMainDockingBar>>menusOn: (in category 'construction') -----
menusOn: aDockingBar
+ (Pragma
+ allNamed: #createDockingBarMenuWithPriority:
+ in: self class
+ sortedByArgument: 1) do: [ :pragma |
+ self perform: pragma selector with: aDockingBar ].
- self
- squeakMenuOn: aDockingBar;
- projectsMenuOn: aDockingBar;
- toolsMenuOn: aDockingBar;
- extrasMenuOn: aDockingBar;
- windowsMenuOn: aDockingBar;
- helpMenuOn: aDockingBar.
aDockingBar addSpacer.
self
searchBarOn: aDockingBar;
clockOn: aDockingBar!
More information about the Squeak-dev
mailing list
|