aboutsummaryrefslogtreecommitdiff
path: root/js/data
diff options
context:
space:
mode:
authorAnanya Sen2012-06-04 10:43:29 -0700
committerAnanya Sen2012-06-04 10:43:29 -0700
commit6fb29883329c9c42a8b406128b92c0e6323a47be (patch)
tree07f46e88bccf9cdb7d4e6818e1b646b0d19f05b9 /js/data
parentcf097ec69e35c07ecae5a105ed5eeb78291c9ac2 (diff)
parentc1ec69879028220b0c3f11ad6e24035bf527802c (diff)
downloadninja-6fb29883329c9c42a8b406128b92c0e6323a47be.tar.gz
Merge branch 'refs/heads/ninja-internal-master' into cut-copy-paste
Conflicts: js/ninja.reel/ninja.html Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/data')
-rwxr-xr-xjs/data/menu-data.js147
1 files changed, 92 insertions, 55 deletions
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
index 0a40f1e8..c47117f8 100755
--- a/js/data/menu-data.js
+++ b/js/data/menu-data.js
@@ -4,9 +4,51 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5</copyright> */
6 6
7var Montage = require("montage/core/core").Montage; 7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component;
9
10exports.MenuData = Montage.create(Component, {
11
12 _currentDocument: {
13 value : null
14 },
15
16 currentDocument : {
17 get : function() {
18 return this._currentDocument;
19 },
20 set : function(value) {
21 if (value === this._currentDocument) {
22 return;
23 }
24
25 this._currentDocument = value;
26
27 this.documentEnabledIndices.forEach(function(index) {
28 index.enabled = true;
29 });
30
31 }
32 },
33
34 didCreate: {
35 value: function() {
36 var self = this;
37
38 this.topLevelMenu.forEach(function(item) {
39 item.entries.forEach(function(entry) {
40 if(entry.depend && entry.depend === "document") {
41 self.documentEnabledIndices.push(entry);
42 }
43 });
44 });
45 }
46 },
47
48 documentEnabledIndices: {
49 value: []
50 },
8 51
9exports.MenuData = Montage.create( Montage, {
10 topLevelMenu: { 52 topLevelMenu: {
11 value: [ 53 value: [
12 { 54 {
@@ -33,65 +75,47 @@ exports.MenuData = Montage.create( Montage, {
33 { 75 {
34 "displayText" : "Close File", 76 "displayText" : "Close File",
35 "hasSubMenu" : false, 77 "hasSubMenu" : false,
36 "enabled": { 78 "enabled": false,
37 "value": false, 79 "depend": "document",
38 "boundObj": "documentController",
39 "boundProperty": "_documents.count()",
40 "oneway": true
41 },
42 "action": "executeFileClose" 80 "action": "executeFileClose"
43 }, 81 },
44 { 82 {
45 "displayText" : "Close All", 83 "displayText" : "Close All",
46 "hasSubMenu" : false, 84 "hasSubMenu" : false,
47 "enabled": { 85 "enabled": false,
48 "value": false, 86 "depend": "document",
49 "boundObj": "documentController",
50 "boundProperty": "_documents.count()",
51 "oneway": true
52 },
53 "action": "executeFileCloseAll" 87 "action": "executeFileCloseAll"
54 }, 88 },
55 { 89 {
56 "displayText" : "", 90 "displayText" : "",
57 "separator": true 91 "separator": true,
92 "enabled": true
58 }, 93 },
59 { 94 {
60 "displayText" : "Save", 95 "displayText" : "Save",
61 "hasSubMenu" : false, 96 "hasSubMenu" : false,
62 "enabled": { 97 "enabled": false,
63 "value": false, 98 "depend": "document",
64 "boundObj": "documentController",
65 "boundProperty": "_documents.count()",
66 "oneway": true
67 },
68 "action": "executeSave" 99 "action": "executeSave"
69 }, 100 },
70 { 101 {
71 "displayText" : "Save As", 102 "displayText" : "Save As",
72 "hasSubMenu" : false, 103 "hasSubMenu" : false,
73 "enabled": { 104 "enabled": false,
74 "value": false, 105 "depend": "document",
75 "boundObj": "documentController",
76 "boundProperty": "_documents.count()",
77 "oneway": true
78 },
79 "action":"executeSaveAs" 106 "action":"executeSaveAs"
80 }, 107 },
81 { 108 {
82 "displayText" : "Save All", 109 "displayText" : "Save All",
83 "hasSubMenu" : false, 110 "hasSubMenu" : false,
84 "enabled": { 111 "enabled": false,
85 "value": false, 112 "depend": "document",
86 "boundObj": "documentController",
87 "boundProperty": "_documents.count()",
88 "oneway": true
89 },
90 "action": "executeSaveAll" 113 "action": "executeSaveAll"
91 }, 114 },
92 { 115 {
93 "displayText" : "", 116 "displayText" : "",
94 "separator": true 117 "separator": true,
118 "enabled": true
95 }, 119 },
96 { 120 {
97 "displayText" : "Open Project", 121 "displayText" : "Open Project",
@@ -107,14 +131,6 @@ exports.MenuData = Montage.create( Montage, {
107 "displayText" : "Close Project", 131 "displayText" : "Close Project",
108 "hasSubMenu" : false, 132 "hasSubMenu" : false,
109 "enabled": false 133 "enabled": false
110 },
111 {
112 "displayText" : "",
113 "separator": true
114 },
115 {
116 "displayText" : "",
117 "separator": true
118 } 134 }
119 ] 135 ]
120 }, 136 },
@@ -124,7 +140,8 @@ exports.MenuData = Montage.create( Montage, {
124 { 140 {
125 "displayText" : "Undo", 141 "displayText" : "Undo",
126 "hasSubMenu" : false, 142 "hasSubMenu" : false,
127 "enabled": { 143 "enabled": false,
144 "newenabled": {
128 "value": false, 145 "value": false,
129 "boundObj": "undocontroller", 146 "boundObj": "undocontroller",
130 "boundProperty": "canUndo", 147 "boundProperty": "canUndo",
@@ -135,7 +152,8 @@ exports.MenuData = Montage.create( Montage, {
135 { 152 {
136 "displayText" : "Redo", 153 "displayText" : "Redo",
137 "hasSubMenu" : false, 154 "hasSubMenu" : false,
138 "enabled": { 155 "enabled": false,
156 "newenabled": {
139 "value": false, 157 "value": false,
140 "boundObj": "undocontroller", 158 "boundObj": "undocontroller",
141 "boundProperty": "canRedo", 159 "boundProperty": "canRedo",
@@ -169,7 +187,9 @@ exports.MenuData = Montage.create( Montage, {
169 { 187 {
170 "displayText" : "Live Preview", 188 "displayText" : "Live Preview",
171 "hasSubMenu" : false, 189 "hasSubMenu" : false,
172 "enabled": { 190 "enabled": false,
191 "depend": "document",
192 "newenabled": {
173 "value": false, 193 "value": false,
174 "boundObj": "documentController", 194 "boundObj": "documentController",
175 "boundProperty": "activeDocument", 195 "boundProperty": "activeDocument",
@@ -186,7 +206,9 @@ exports.MenuData = Montage.create( Montage, {
186 { 206 {
187 "displayText" : "Chrome Preview", 207 "displayText" : "Chrome Preview",
188 "hasSubMenu" : false, 208 "hasSubMenu" : false,
189 "enabled": { 209 "enabled": false,
210 "depend": "document",
211 "newenabled": {
190 "value": false, 212 "value": false,
191 "boundObj": "documentController", 213 "boundObj": "documentController",
192 "boundProperty": "activeDocument", 214 "boundProperty": "activeDocument",
@@ -203,7 +225,9 @@ exports.MenuData = Montage.create( Montage, {
203 { 225 {
204 "displayText" : "Layout View", 226 "displayText" : "Layout View",
205 "hasSubMenu" : false, 227 "hasSubMenu" : false,
206 "enabled": { 228 "enabled": false,
229 "depend": "document",
230 "newenabled": {
207 "value": false, 231 "value": false,
208 "boundObj": "documentController", 232 "boundObj": "documentController",
209 "boundProperty": "activeDocument", 233 "boundProperty": "activeDocument",
@@ -249,7 +273,9 @@ exports.MenuData = Montage.create( Montage, {
249 { 273 {
250 "displayText" : "Snap", 274 "displayText" : "Snap",
251 "hasSubMenu" : false,