[squeak-dev] The Trunk: Morphic-kb.240.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Nov 20 03:43:21 UTC 2009
Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-kb.240.mcz
==================== Summary ====================
Name: Morphic-kb.240
Author: kb
Time: 20 November 2009, 1:40:40 am
UUID: 3f82a1c6-ee8f-bf4b-98cc-a2ef45557219
Ancestors: Morphic-kb.239
- Refactoring of TheWorldMainDockingBar
- Added some helper methods to MenuItemMorph, MenuMorph, DockingBarMorph
- Added a menu to the docking bar listing windows not collapsed
=============== Diff against Morphic-kb.238 ===============
Item was added:
+ ----- Method: MenuItemMorph>>subMenuUpdater: (in category 'accessing') -----
+ subMenuUpdater: aBlock
+
+ subMenuUpdater := aBlock.
+ self changed.
+ !
Item was added:
+ ----- Method: MenuItemMorph>>updateSubMenu (in category 'selecting') -----
+ updateSubMenu
+
+ | menu |
+ subMenuUpdater ifNil: [^self ].
+ menu := MenuMorph new.
+ subMenuUpdater value: menu.
+ self subMenu: menu!
Item was changed:
StringMorph subclass: #MenuItemMorph
+ instanceVariableNames: 'isEnabled subMenu isSelected target selector arguments icon lastMousePosition subMenuUpdater'
- instanceVariableNames: 'isEnabled subMenu isSelected target selector arguments icon lastMousePosition'
classVariableNames: 'SubMenuMarker'
poolDictionaries: ''
category: 'Morphic-Menus'!
!MenuItemMorph commentStamp: '<historical>' prior: 0!
I represent an item in a menu.
Instance variables:
isEnabled <Boolean> True if the menu item can be executed.
subMenu <MenuMorph | nil> The submenu to activate automatically when the user mouses over the item.
isSelected <Boolean> True if the item is currently selected.
target <Object> The target of the associated action.
selector <Symbol> The associated action.
arguments <Array> The arguments for the associated action.
icon <Form | nil> An optional icon form to be displayed to my left.
If I have a dynamic marker, created by strings like <yes> or <no> in my contents, it will be installed as a submorph.!
Item was added:
+ ----- Method: MenuMorph>>addItem: (in category 'construction') -----
+ addItem: aBlock
+
+ | item |
+ item := MenuItemMorph new.
+ aBlock value: item.
+ self addMorphBack: item!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>workspaceMenuItemOn: (in category 'submenu - tools') -----
+ workspaceMenuItemOn: item
+
+ item
+ contents: 'Workspace';
+ help: 'Open a workspace';
+ icon: (self colorIcon: Preferences workspaceWindowColor);
+ action: [ StandardToolSet openWorkspace ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>transcriptMenuItemOn: (in category 'submenu - tools') -----
+ transcriptMenuItemOn: item
+
+ item
+ contents: 'Transcript';
+ help: 'Open the Transcript';
+ icon: (self colorIcon: Preferences transcriptWindowColor);
+ action: [ Transcript open ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>loadProjectMenuItemOn: (in category 'submenu - projects') -----
+ loadProjectMenuItemOn: item
+
+ item
+ contents: 'Previous Project';
+ help: 'Return to the most-recently-visited project';
+ icon: MenuIcons smallBackIcon;
+ action: [ World goBack ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>toolsMenuOn: (in category 'construction') -----
+ toolsMenuOn: aDockingBar
+
+ aDockingBar addItem: [ :item |
+ item
+ contents: 'Tools' translated;
+ addSubMenu: [ :menu | self buildMenu: self toolsMenu on: menu ] ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>newProjectMenuItemOn: (in category 'submenu - projects') -----
+ newProjectMenuItemOn: item
+
+ item
+ contents: 'New Project';
+ help: 'Start a new project';
+ icon: MenuIcons smallProjectIcon;
+ action: [ MorphicProject openViewOn: nil ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>monticelloBrowserMenuItemOn: (in category 'submenu - tools') -----
+ monticelloBrowserMenuItemOn: item
+
+ item
+ contents: 'Monticello Browser';
+ help: 'Open a Monticello Browser';
+ icon: (self colorIcon: MCTool basicNew defaultBackgroundColor);
+ action: [ MCWorkingCopyBrowser open ]!
Item was added:
+ ----- Method: DockingBarMorph>>addItem: (in category 'construction') -----
+ addItem: aBlock
+ | item |
+ item := DockingBarItemMorph new.
+ aBlock value: item.
+ self addMorphBack: item!
Item was added:
+ ----- 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 added:
+ ----- Method: TheWorldMainDockingBar>>saveAsMenuItemOn: (in category 'submenu - squeak') -----
+ saveAsMenuItemOn: item
+
+ 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 added:
+ ----- Method: MenuItemMorph>>addSubMenu: (in category 'accessing') -----
+ addSubMenu: aBlock
+
+ subMenu := MenuMorph new.
+ aBlock value: subMenu.
+ self changed.
+ !
Item was added:
+ ----- Method: TheWorldMainDockingBar>>buildMenu:on: (in category 'private') -----
+ buildMenu: description on: menu
+
+ menu defaultTarget: self.
+ description do: [ :each |
+ self buildMenuItem: each on: menu ]!
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 added:
+ ----- Method: MenuItemMorph>>action: (in category 'accessing') -----
+ action: aBlock
+
+ self
+ target: aBlock;
+ selector: #value!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>projectsMenuOn: (in category 'construction') -----
+ projectsMenuOn: aDockingBar
+
+ aDockingBar addItem: [ :item |
+ item
+ contents: 'Projects' translated;
+ addSubMenu: [ :menu | self buildMenu: self projectsMenu on: menu ] ]
+ !
Item was added:
+ ----- Method: TheWorldMainDockingBar>>jumpToProjectMenuItemOn: (in category 'submenu - projects') -----
+ jumpToProjectMenuItemOn: item
+
+ item
+ contents: 'Jump To Project';
+ icon: MenuIcons smallForwardIcon;
+ subMenuUpdater: [ :menu |
+ menu defaultTarget: Project.
+ Project buildJumpToMenu: menu ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>quitMenuItemOn: (in category 'submenu - squeak') -----
+ quitMenuItemOn: item
+
+ 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 added:
+ ----- Method: TheWorldMainDockingBar>>saveMenuItemOn: (in category 'submenu - squeak') -----
+ saveMenuItemOn: item
+
+ 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>>saveProjectMenuItemOn: (in category 'submenu - projects') -----
+ saveProjectMenuItemOn: item
+
+ item
+ contents: 'Save Project';
+ help: 'Save this project on a file';
+ icon: MenuIcons smallPublishIcon;
+ action: [ World saveOnFile ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>testRunnerMenuItemOn: (in category 'submenu - tools') -----
+ testRunnerMenuItemOn: item
+
+ item
+ contents: 'Test Runner';
+ help: 'Open the Test Runner';
+ icon: (self colorIcon: Preferences testRunnerWindowColor);
+ action: [ TestRunner open ]!
Item was added:
+ ----- 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 buildMenu: self squeakMenu on: menu ] ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>updateMenuItemOn: (in category 'submenu - squeak') -----
+ updateMenuItemOn: item
+
+ item
+ contents: 'Update Squeak';
+ help: 'Load latest code updates via the internet';
+ action: [ Utilities updateFromServer ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>saveAsNewVersionMenuItemOn: (in category 'submenu - squeak') -----
+ saveAsNewVersionMenuItemOn: item
+
+ 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 added:
+ ----- Method: TheWorldMainDockingBar>>aboutMenuItemOn: (in category 'submenu - squeak') -----
+ aboutMenuItemOn: item
+
+ item
+ contents: 'About Squeak...' translated;
+ action: [ ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>windowsMenuOn: (in category 'construction') -----
+ windowsMenuOn: aDockingBar
+
+ aDockingBar addItem: [ :item |
+ item
+ contents: 'Windows' translated;
+ subMenuUpdater: [ :menu | self listWindowsOn: menu ] ]
+ !
Item was added:
+ ----- Method: TheWorldMainDockingBar>>saveAndQuitMenuItemOn: (in category 'submenu - squeak') -----
+ saveAndQuitMenuItemOn: item
+
+ 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>>browserMenuItemOn: (in category 'submenu - tools') -----
+ browserMenuItemOn: item
+
+ item
+ contents: 'Browser';
+ help: 'Open a browser';
+ icon: (self colorIcon: Preferences browserWindowColor);
+ action: [ StandardToolSet openClassBrowser ]!
Item was added:
+ ----- Method: TheWorldMainDockingBar>>fileListMenuItemOn: (in category 'submenu - tools') -----
+ fileListMenuItemOn: item
+
+ 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
+ squeakMenuOn: aDockingBar;
+ toolsMenuOn: aDockingBar;
+ projectsMenuOn: aDockingBar;
+ windowsMenuOn: aDockingBar.
aDockingBar
- add: ''
- icon: MenuIcons squeakLogoIcon
- selectedIcon: MenuIcons squeakLogoInvertedIcon
- help: nil
- subMenu: (self createSubmenuFrom: self squeakMenu).
- aDockingBar
- add: 'Tools' translated
- icon: nil
- help: nil
- subMenu: (self createSubmenuFrom: self toolsMenu).
- aDockingBar
- add: 'Projects' translated
- icon: nil
- help: nil
- subMenu: (self createSubmenuFrom: self projectsMenu).
- aDockingBar
setProperty: #mainDockingBarTimeStamp
toValue: self class timeStamp!
Item was added:
+ ----- 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);
+ action: [ each activateAndForceLabelToShow ] ] ].!
Item was added:
+ ----- Method: MenuItemMorph>>help: (in category 'accessing') -----
+ help: aString
+
+ self setBalloonText: aString!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>updateMenuItem (in category 'submenu - squeak') -----
- updateMenuItem
-
- ^{ 'Update Squeak'.
- 'Load latest code updates via the internet'.
- nil.
- [ Utilities updateFromServer ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>newProjectMenuItem (in category 'submenu - projects') -----
- newProjectMenuItem
-
- ^{ 'New Project'.
- 'Start a new project'.
- MenuIcons smallProjectIcon.
- [ MorphicProject openViewOn: nil ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>saveAsNewVersionMenuItem (in category 'submenu - squeak') -----
- saveAsNewVersionMenuItem
-
- ^{ 'Save As New Version'.
- 'Save the current state of Squeak on disk under a version-stamped name'.
- MenuIcons smallSaveAsIcon.
- [ SmalltalkImage current saveAsNewVersion ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>workspaceMenuItem (in category 'submenu - tools') -----
- workspaceMenuItem
-
- ^{ 'Workspace'.
- 'Open a workspace'.
- self colorIcon: Preferences workspaceWindowColor.
- [ StandardToolSet openWorkspace ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>saveMenuItem (in category 'submenu - squeak') -----
- saveMenuItem
-
- ^{ 'Save Image'.
- 'Save the current state of Squeak on disk'.
- MenuIcons smallSaveIcon.
- [ SmalltalkImage current snapshot: true andQuit: false ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>createMenuItem:on: (in category 'private') -----
- createMenuItem: selector on: menu
-
- | item wording help icon action |
- selector first = $=
- ifTrue: [ ^menu addLine ]
- ifFalse: [ item := self perform: (selector, 'MenuItem') asSymbol ].
- wording := item first.
- help := item second.
- icon := item third.
- action := item fourth.
- action isSymbol
- ifTrue: [
- menu
- add: wording translated
- target: self
- selector: action ]
- ifFalse: [
- action isBlock
- ifTrue: [
- menu
- add: wording translated
- target: action
- selector: #value ]
- ifFalse: [
- menu
- add: wording translated
- subMenu: action ] ].
- help ifNotNil: [
- menu lastItem setBalloonText: help translated ].
- icon ifNotNil: [
- Preferences tinyDisplay ifFalse: [
- menu lastItem icon: icon ] ]!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>saveAndQuitMenuItem (in category 'submenu - squeak') -----
- saveAndQuitMenuItem
-
- ^{ 'Save And Quit'.
- 'Save the current state of Squeak on disk, and quit out of Squeak'.
- MenuIcons smallQuitIcon.
- [ SmalltalkImage current snapshot: true andQuit: true ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>fileListMenuItem (in category 'submenu - tools') -----
- fileListMenuItem
-
- ^{ 'File List'.
- 'Open a file list'.
- self colorIcon: Preferences fileListWindowColor.
- [ StandardToolSet openFileList ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>monticelloBrowserMenuItem (in category 'submenu - tools') -----
- monticelloBrowserMenuItem
-
- ^{ 'Monticello Browser'.
- 'Open a Monticello Browser'.
- self colorIcon: MCTool basicNew defaultBackgroundColor.
- [ MCWorkingCopyBrowser open ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>quitMenuItem (in category 'submenu - squeak') -----
- quitMenuItem
-
- ^{ 'Quit'.
- 'Quit out of Squeak'.
- MenuIcons smallQuitIcon.
- [ SmalltalkImage current
- snapshot: (
- self
- confirm: 'Save changes before quitting?' translated
- orCancel: [ ^self ])
- andQuit: true ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>aboutMenuItem (in category 'submenu - squeak') -----
- aboutMenuItem
-
- ^{ 'About Squeak...'.
- nil.
- nil.
- [ ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>browserMenuItem (in category 'submenu - tools') -----
- browserMenuItem
-
- ^{ 'Browser'.
- 'Open a browser'.
- self colorIcon: Preferences browserWindowColor.
- [ StandardToolSet openClassBrowser ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>saveProjectMenuItem (in category 'submenu - projects') -----
- saveProjectMenuItem
-
- ^{ 'Save Project'.
- 'Save this project on a file'.
- MenuIcons smallPublishIcon.
- [ World saveOnFile ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>createSubmenuFrom: (in category 'private') -----
- createSubmenuFrom: description
-
- | menu |
- menu := MenuMorph new defaultTarget: self.
- description do: [ :each |
- self createMenuItem: each on: menu ].
- ^menu!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>loadProjectMenuItem (in category 'submenu - projects') -----
- loadProjectMenuItem
-
- ^{ 'Previous Project'.
- 'Return to the most-recently-visited project'.
- MenuIcons smallBackIcon.
- [ World goBack ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>saveAsMenuItem (in category 'submenu - squeak') -----
- saveAsMenuItem
-
- ^{ 'Save Image As...'.
- 'Save the current state of Squeak on disk under a new name'.
- MenuIcons smallSaveAsIcon.
- [ SmalltalkImage current saveAs ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>jumpToProjectMenuItem (in category 'submenu - projects') -----
- jumpToProjectMenuItem
-
- ^{ 'Jump To Project'.
- 'Start a new project'.
- MenuIcons smallForwardIcon.
- [ Project jumpToProject ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>testRunnerMenuItem (in category 'submenu - tools') -----
- testRunnerMenuItem
-
- ^{ 'Test Runner'.
- 'Open the Test Runner'.
- self colorIcon: Preferences testRunnerWindowColor.
- [ TestRunner open ] }!
Item was removed:
- ----- Method: TheWorldMainDockingBar>>transcriptMenuItem (in category 'submenu - tools') -----
- transcriptMenuItem
-
- ^{ 'Transcript'.
- 'Open the Transcript'.
- self colorIcon: Preferences transcriptWindowColor.
- [ Transcript open ] }!
More information about the Squeak-dev
mailing list
|