aboutsummaryrefslogtreecommitdiff
path: root/js/data/menu-data.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-18 16:24:45 -0700
committerValerio Virgillito2012-07-18 16:24:45 -0700
commitf79f7c540d8533eed8fc562b809e15dcfea94438 (patch)
tree955b0d51fb163fb0a5165a6e16bf503de4cda712 /js/data/menu-data.js
parent71650434d5b78c2b86dc8a689d0c9034d418f38b (diff)
parent6f2e455a77179f81dfd19037c078c158d3e14ee2 (diff)
downloadninja-f79f7c540d8533eed8fc562b809e15dcfea94438.tar.gz
Merge branch 'menu-fixes' of https://github.com/mencio/ninja
Diffstat (limited to 'js/data/menu-data.js')
-rwxr-xr-xjs/data/menu-data.js582
1 files changed, 0 insertions, 582 deletions
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
deleted file mode 100755
index f942f953..00000000
--- a/js/data/menu-data.js
+++ /dev/null
@@ -1,582 +0,0 @@
1/* <copyright>
2Copyright (c) 2012, Motorola Mobility LLC.
3All Rights Reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10
11* Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution.
14
15* Neither the name of Motorola Mobility LLC nor the names of its
16 contributors may be used to endorse or promote products derived from this
17 software without specific prior written permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29POSSIBILITY OF SUCH DAMAGE.
30</copyright> */
31
32var Montage = require("montage/core/core").Montage,
33 Component = require("montage/ui/component").Component;
34
35exports.MenuData = Montage.create(Component, {
36
37 _currentDocument: {
38 value : null
39 },
40
41 currentDocument : {
42 get : function() {
43 return this._currentDocument;
44 },
45 set : function(value) {
46 if (value === this._currentDocument) {
47 return;
48 }
49
50 this._currentDocument = value;
51
52 if(!this._currentDocument) {
53 this.documentEnabledIndices.forEach(function(index) {
54 index.enabled = false;
55 });
56 } else {
57 this.documentEnabledIndices.forEach(function(index) {
58 index.enabled = true;
59 });
60 }
61
62 }
63 },
64
65 didCreate: {
66 value: function() {
67 var self = this;
68
69 this.topLevelMenu.forEach(function(item) {
70 item.entries.forEach(function(entry) {
71 if(entry.depend && entry.depend === "document") {
72 self.documentEnabledIndices.push(entry);
73 }
74 });
75 });
76 }
77 },
78
79 documentEnabledIndices: {
80 value: []
81 },
82
83 topLevelMenu: {
84 value: [
85 {
86 "header": "File",
87 "entries": [
88 {
89 "displayText" : "New Project",
90 "hasSubMenu" : false,
91 "enabled": false,
92 "action": "executeNewProject"
93 },
94 {
95 "displayText" : "New File",
96 "hasSubMenu" : false,
97 "enabled": true,
98 "action": "executeNewFile"
99 },
100 {
101 "displayText" : "Open File",
102 "hasSubMenu" : false,
103 "enabled": true,
104 "action": "executeFileOpen"
105 },
106 {
107 "displayText" : "Close File",
108 "hasSubMenu" : false,
109 "enabled": false,
110 "depend": "document",
111 "action": "executeFileClose"
112 },
113 {
114 "displayText" : "Close All",
115 "hasSubMenu" : false,
116 "enabled": false,
117 "depend": "document",
118 "action": "executeFileCloseAll"
119 },
120 {
121 "displayText" : "",
122 "separator": true,
123 "enabled": true
124 },
125 {
126 "displayText" : "Save",
127 "hasSubMenu" : false,
128 "enabled": false,
129 "depend": "document",
130 "action": "executeSave"
131 },
132 {
133 "displayText" : "Save As",
134 "hasSubMenu" : false,
135 "enabled": false,
136 "depend": "document",
137 "action":"executeSaveAs"
138 },
139 {
140 "displayText" : "Save All",
141 "hasSubMenu" : false,
142 "enabled": false,
143 "depend": "document",
144 "action": "executeSaveAll"
145 },
146 {
147 "displayText" : "",
148 "separator": true,
149 "enabled": true
150 },
151 {
152 "displayText" : "Open Project",
153 "hasSubMenu" : false,
154 "enabled": false
155 },
156 {
157 "displayText" : "Open Recent",
158 "hasSubMenu" : false,
159 "enabled": false
160 },
161 {
162 "displayText" : "Close Project",
163 "hasSubMenu" : false,
164 "enabled": false
165 }
166 ]
167 },
168 {
169 "header": "Edit",
170 "entries": [
171 {
172 "displayText" : "Undo",
173 "hasSubMenu" : false,
174 "enabled": false,
175 "newenabled": {
176 "value": false,
177 "boundObj": "undocontroller",
178 "boundProperty": "canUndo",
179 "oneway": true
180 },
181 "action": "executeUndo"
182 },
183 {
184 "displayText" : "Redo",
185 "hasSubMenu" : false,
186 "enabled": false,
187 "newenabled": {
188 "value": false,
189 "boundObj": "undocontroller",
190 "boundProperty": "canRedo",
191 "oneway": true
192 },
193 "action": "executeRedo"
194 },
195 {
196 "displayText" : "Cut",
197 "hasSubMenu" : false,
198 "enabled": true,
199 "action": "executeCut"
200 },
201 {
202 "displayText" : "Copy",
203 "hasSubMenu" : false,
204 "enabled": true,
205 "action": "executeCopy"
206 },
207 {
208 "displayText" : "Paste",
209 "hasSubMenu" : false,
210 "enabled": true,
211 "action": "executePaste"
212 }
213 ]
214 },
215 {
216 "header": "View",
217 "entries": [
218 {
219 "displayText" : "Live Preview",
220 "hasSubMenu" : false,
221 "enabled": false,
222 "depend": "document",
223 "newenabled": {
224 "value": false,
225 "boundObj": "documentController",
226 "boundProperty": "activeDocument",
227 "oneway": true,
228 "boundValueMutator": function(activeDocument){
229 return (activeDocument !== null) && (activeDocument.currentView === "design");
230 }
231 },
232 "checked": {
233 "value": false,
234 "boundProperty": "livePreview"
235 }
236 },
237 {
238 "displayText" : "Chrome Preview",