From 1fae8b14621970680ca51c2a4a5f4f8006e1aee2 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 25 Jul 2012 00:04:22 -0700 Subject: design/code view switching for stage and menu Signed-off-by: Valerio Virgillito --- js/ui/menu/menu-controller.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'js/ui/menu') diff --git a/js/ui/menu/menu-controller.js b/js/ui/menu/menu-controller.js index c80745f4..ebffddf1 100644 --- a/js/ui/menu/menu-controller.js +++ b/js/ui/menu/menu-controller.js @@ -56,6 +56,7 @@ exports.MenuController = Montage.create(Component, { if(this._currentDocument && this._currentDocument.currentView === "design") { document.application.model.show3dGrid = this._currentDocument.model.draw3DGrid; this.topLevelMenu[2].entries[5].checked = this._currentDocument.model.draw3DGrid; + this._currentDocument.addPropertyChangeListener("model.currentViewIdentifier", this, false); } if(!this._currentDocument) { @@ -85,6 +86,22 @@ exports.MenuController = Montage.create(Component, { } }, + handleChange: { + value: function(notification) { + if(notification.currentPropertyPath === "model.currentViewIdentifier") { + if(this.currentDocument.model.currentView.identifier === "design-code") { + this.designDocumentEnabledItems.forEach(function(index) { + index.enabled = false; + }); + } else { + this.designDocumentEnabledItems.forEach(function(index) { + index.enabled = true; + }); + } + } + } + }, + didCreate: { value: function() { var self = this; -- cgit v1.2.3