aboutsummaryrefslogtreecommitdiff
path: root/js/data
diff options
context:
space:
mode:
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 aeb95ccc..6c597542 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",
@@ -166,7 +184,9 @@ exports.MenuData = Montage.create( Montage, {
166 { 184 {
167 "displayText" : "Live Preview", 185 "displayText" : "Live Preview",
168 "hasSubMenu" : false, 186 "hasSubMenu" : false,
169 "enabled": { 187 "enabled": false,
188 "depend": "document",
189 "newenabled": {
170 "value": false, 190 "value": false,
171 "boundObj": "documentController", 191 "boundObj": "documentController",
172 "boundProperty": "activeDocument", 192 "boundProperty": "activeDocument",
@@ -183,7 +203,9 @@ exports.MenuData = Montage.create( Montage, {
183 { 203 {
184 "displayText" : "Chrome Preview", 204 "displayText" : "Chrome Preview",
185 "hasSubMenu" : false, 205 "hasSubMenu" : false,
186 "enabled": { 206 "enabled": false,
207 "depend": "document",
208 "newenabled": {
187 "value": false, 209 "value": false,
188 "boundObj": "documentController", 210 "boundObj": "documentController",
189 "boundProperty": "activeDocument", 211 "boundProperty": "activeDocument",
@@ -200,7 +222,9 @@ exports.MenuData = Montage.create( Montage, {
200 { 222 {
201 "displayText" : "Layout View", 223 "displayText" : "Layout View",
202 "hasSubMenu" : false, 224 "hasSubMenu" : false,
203 "enabled": { 225 "enabled": false,
226 "depend": "document",
227 "newenabled": {
204 "value": false, 228 "value": false,
205 "boundObj": "documentController", 229 "boundObj": "documentController",
206 "boundProperty": "activeDocument", 230 "boundProperty": "activeDocument",
@@ -246,7 +270,9 @@ exports.MenuData = Montage.create( Montage, {
246 { 270 {
247 "displayText" : "Snap", 271 "displayText" : "Snap",
248 "hasSubMenu" : false, 272 "hasSubMenu" : false,
249 "enabled": { 273 "enabled": false,
274 "depend": "document",
275 "newenabled": {
250 "value": false, 276 "value": false,
251 "boundObj": "documentController", 277 "boundObj": "documentController",