aboutsummaryrefslogtreecommitdiff
path: root/js/data
diff options
context:
space:
mode:
Diffstat (limited to 'js/data')
-rwxr-xr-xjs/data/menu-data.js153
-rwxr-xr-xjs/data/pi/pi-data.js10
-rwxr-xr-xjs/data/tools-data.js4
3 files changed, 107 insertions, 60 deletions
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
index aeb95ccc..b6350893 100755
--- a/js/data/menu-data.js
+++ b/js/data/menu-data.js
@@ -4,9 +4,57 @@ 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 if(!this._currentDocument) {
28 this.documentEnabledIndices.forEach(function(index) {
29 index.enabled = false;
30 });
31 } else {
32 this.documentEnabledIndices.forEach(function(index) {
33 index.enabled = true;
34 });
35 }
36
37 }
38 },
39
40 didCreate: {
41 value: function() {
42 var self = this;
43
44 this.topLevelMenu.forEach(function(item) {
45 item.entries.forEach(function(entry) {
46 if(entry.depend && entry.depend === "document") {
47 self.documentEnabledIndices.push(entry);
48 }
49 });
50 });
51 }
52 },
53
54 documentEnabledIndices: {
55 value: []
56 },
8 57
9exports.MenuData = Montage.create( Montage, {
10 topLevelMenu: { 58 topLevelMenu: {
11 value: [ 59 value: [
12 { 60 {
@@ -33,65 +81,47 @@ exports.MenuData = Montage.create( Montage, {
33 { 81 {
34 "displayText" : "Close File", 82 "displayText" : "Close File",
35 "hasSubMenu" : false, 83 "hasSubMenu" : false,
36 "enabled": { 84 "enabled": false,
37 "value": false, 85 "depend": "document",
38 "boundObj": "documentController",
39 "boundProperty": "_documents.count()",
40 "oneway": true
41 },
42 "action": "executeFileClose" 86 "action": "executeFileClose"
43 }, 87 },
44 { 88 {
45 "displayText" : "Close All", 89 "displayText" : "Close All",
46 "hasSubMenu" : false, 90 "hasSubMenu" : false,
47 "enabled": { 91 "enabled": false,
48 "value": false, 92 "depend": "document",
49 "boundObj": "documentController",
50 "boundProperty": "_documents.count()",
51 "oneway": true
52 },
53 "action": "executeFileCloseAll" 93 "action": "executeFileCloseAll"
54 }, 94 },
55 { 95 {
56 "displayText" : "", 96 "displayText" : "",
57 "separator": true 97 "separator": true,
98 "enabled": true
58 }, 99 },
59 { 100 {
60 "displayText" : "Save", 101 "displayText" : "Save",
61 "hasSubMenu" : false, 102 "hasSubMenu" : false,
62 "enabled": { 103 "enabled": false,
63 "value": false, 104 "depend": "document",
64 "boundObj": "documentController",
65 "boundProperty": "_documents.count()",
66 "oneway": true
67 },
68 "action": "executeSave" 105 "action": "executeSave"
69 }, 106 },
70 { 107 {
71 "displayText" : "Save As", 108 "displayText" : "Save As",
72 "hasSubMenu" : false, 109 "hasSubMenu" : false,
73 "enabled": { 110 "enabled": false,
74 "value": false, 111 "depend": "document",
75 "boundObj": "documentController",
76 "boundProperty": "_documents.count()",
77 "oneway": true
78 },
79 "action":"executeSaveAs" 112 "action":"executeSaveAs"
80 }, 113 },
81 { 114 {
82 "displayText" : "Save All", 115 "displayText" : "Save All",
83 "hasSubMenu" : false, 116 "hasSubMenu" : false,
84 "enabled": { 117 "enabled": false,
85 "value": false, 118 "depend": "document",
86 "boundObj": "documentController",
87 "boundProperty": "_documents.count()",
88 "oneway": true
89 },
90 "action": "executeSaveAll" 119 "action": "executeSaveAll"
91 }, 120 },
92 { 121 {
93 "displayText" : "", 122 "displayText" : "",
94 "separator": true 123 "separator": true,
124 "enabled": true
95 }, 125 },
96 { 126 {
97 "displayText" : "Open Project", 127 "displayText" : "Open Project",
@@ -107,14 +137,6 @@ exports.MenuData = Montage.create( Montage, {
107 "displayText" : "Close Project", 137 "displayText" : "Close Project",
108 "hasSubMenu" : false, 138 "hasSubMenu" : false,
109 "enabled": false 139 "enabled": false
110 },
111 {
112 "displayText" : "",
113 "separator": true
114 },
115 {
116 "displayText" : "",
117 "separator": true
118 } 140 }
119 ] 141 ]
120 }, 142 },
@@ -124,7 +146,8 @@ exports.MenuData = Montage.create( Montage, {
124 { 146 {
125 "displayText" : "Undo", 147 "displayText" : "Undo",
126 "hasSubMenu" : false, 148 "hasSubMenu" : false,
127 "enabled": { 149 "enabled": false,
150 "newenabled": {
128 "value": false, 151 "value": false,
129 "boundObj": "undocontroller", 152 "boundObj": "undocontroller",
130 "boundProperty": "canUndo", 153 "boundProperty": "canUndo",
@@ -135,7 +158,8 @@ exports.MenuData = Montage.create( Montage, {
135 { 158 {
136 "displayText" : "Redo", 159 "displayText" : "Redo",
137 "hasSubMenu" : false, 160 "hasSubMenu" : false,
138 "enabled": { 161 "enabled": false,
162 "newenabled": {
139 "value": false, 163 "value": false,
140 "boundObj": "undocontroller", 164 "boundObj": "undocontroller",
141 "boundProperty": "canRedo", 165 "boundProperty": "canRedo",
@@ -166,7 +190,9 @@ exports.MenuData = Montage.create( Montage, {
166 { 190 {
167 "displayText" : "Live Preview", 191 "displayText" : "Live Preview",
168 "hasSubMenu" : false, 192 "hasSubMenu" : false,
169 "enabled": { 193 "enabled": false,
194 "depend": "document",
195 "newenabled": {
170 "value": false, 196 "value": false,
171 "boundObj": "documentController", 197 "boundObj": "documentController",
172 "boundProperty": "activeDocument", 198 "boundProperty": "activeDocument",
@@ -183,7 +209,9 @@ exports.MenuData = Montage.create( Montage, {
183 { 209 {
184 "displayText" : "Chrome Preview", 210 "displayText" : "Chrome Preview",
185 "hasSubMenu" : false, 211 "hasSubMenu" : false,
186 "enabled": { 212 "enabled": false,
213 "depend": "document",
214 "newenabled": {
187 "value": false, 215 "value": false,
188 "boundObj": "documentController", 216 "boundObj": "documentController",
189 "boundProperty": "activeDocument", 217 "boundProperty": "activeDocument",
@@ -200,7 +228,9 @@ exports.MenuData = Montage.create( Montage, {
200 { 228 {
201 "displayText" : "Layout View", 229 "displayText" : "Layout View",
202 "hasSubMenu" : false, 230 "hasSubMenu" : false,
203 "enabled": { 231 "enabled": false,
232 "depend": "document",
233 "newenabled": {
204 "value": false, 234 "value": false,
205 "boundObj": "documentController", 235 "boundObj": "documentController",
206 "boundProperty": "activeDocument", 236 "boundProperty": "activeDocument",
@@ -246,7 +276,9 @@ exports.Men