From 3fe56ceacc70f839887d0d368ea125cb85f54a8c Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 22 Mar 2012 15:33:12 -0700 Subject: disable more menus if the active document is not in design view Signed-off-by: Ananya Sen --- js/data/menu-data.js | 110 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 100 insertions(+), 10 deletions(-) (limited to 'js/data') diff --git a/js/data/menu-data.js b/js/data/menu-data.js index 093ecf14..12007f4a 100755 --- a/js/data/menu-data.js +++ b/js/data/menu-data.js @@ -174,12 +174,30 @@ exports.MenuData = Montage.create( Montage, { { "displayText" : "Zoom In", "hasSubMenu" : false, - "enabled": true + "enabled": { + "value": false, + "boundObj": "documentController", + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;} + else{return false;} + } + } }, { "displayText" : "Zoom Out", "hasSubMenu" : false, - "enabled": true + "enabled": { + "value": false, + "boundObj": "documentController", + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;} + else{return false;} + } + } }, { "displayText" : "", @@ -188,7 +206,16 @@ exports.MenuData = Montage.create( Montage, { { "displayText" : "Live Preview", "hasSubMenu" : false, - "enabled": true, + "enabled": { + "value": false, + "boundObj": "documentController", + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;} + else{return false;} + } + }, "checked": { "value": false, "boundProperty": "livePreview" @@ -197,7 +224,16 @@ exports.MenuData = Montage.create( Montage, { { "displayText" : "Chrome Preview", "hasSubMenu" : false, - "enabled": true, + "enabled": { + "value": false, + "boundObj": "documentController", + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;} + else{return false;} + } + }, "checked": { "value": false, "boundProperty": "chromePreview" @@ -206,7 +242,16 @@ exports.MenuData = Montage.create( Montage, { { "displayText" : "Layout View", "hasSubMenu" : false, - "enabled": true, + "enabled": { + "value": false, + "boundObj": "documentController", + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;} + else{return false;} + } + }, "submenu": true, "entries": [ { @@ -244,7 +289,16 @@ exports.MenuData = Montage.create( Montage, { { "displayText" : "Snap", "hasSubMenu" : false, - "enabled": true, + "enabled": { + "value": false, + "boundObj": "documentController", + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;} + else{return false;} + } + }, "checked": { "value": true, "boundProperty": "snap" @@ -294,7 +348,16 @@ exports.MenuData = Montage.create( Montage, { { "displayText" : "Show 3D Grid", "hasSubMenu" : false, - "enabled": true, + "enabled": { + "value": false, + "boundObj": "documentController", + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;} + else{return false;} + } + }, "checked": { "value": false, "boundProperty": "show3dGrid" @@ -307,7 +370,16 @@ exports.MenuData = Montage.create( Montage, { { "displayText" : "Front View", "hasSubMenu" : false, - "enabled": true, + "enabled": { + "value": false, + "boundObj": "documentController", + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;} + else{return false;} + } + }, "radio": true, "checked": { "value": true, @@ -317,7 +389,16 @@ exports.MenuData = Montage.create( Montage, { { "displayText" : "Top View", "hasSubMenu" : false, - "enabled": true, + "enabled": { + "value": false, + "boundObj": "documentController", + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;} + else{return false;} + } + }, "radio": true, "checked": { "value": true, @@ -327,7 +408,16 @@ exports.MenuData = Montage.create( Montage, { { "displayText" : "Side View", "hasSubMenu" : false, - "enabled": true, + "enabled": { + "value": false, + "boundObj": "documentController", + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;} + else{return false;} + } + }, "radio": true, "checked": { "value": true, -- cgit v1.2.3