diff options
author | Armen Kesablyan | 2012-06-19 01:03:59 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-19 01:03:59 -0700 |
commit | 2e13a73e4ee980a6f73f6ff48b2a195eb209a7db (patch) | |
tree | d352f5e769eae0e1b7b76ccbeafa9b174b1a9918 /js/ninja.reel/ninja.js | |
parent | 244e608645778746d1a3b5aa0d4c0868f7c5c272 (diff) | |
parent | c59eb371559a3061ce53223e249ca97daace5968 (diff) | |
download | ninja-2e13a73e4ee980a6f73f6ff48b2a195eb209a7db.tar.gz |
Merge branch 'refs/heads/master' into binding
Conflicts:
js/components/layout/tools-list.reel/tools-list.html
js/components/layout/tools-properties.reel/tools-properties.html
js/document/document-html.js
js/document/templates/app/main.js
js/panels/Panel.reel/Panel.js
node_modules/montage/ui/native-control.js
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/ninja.reel/ninja.js')
-rwxr-xr-x | js/ninja.reel/ninja.js | 187 |
1 files changed, 160 insertions, 27 deletions
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 4127e59a..f1825b9a 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js | |||
@@ -15,22 +15,172 @@ var NjUtils = require("js/lib/NJUtils").NJUtils; | |||
15 | 15 | ||
16 | exports.Ninja = Montage.create(Component, { | 16 | exports.Ninja = Montage.create(Component, { |
17 | 17 | ||
18 | ninjaVersion: { | 18 | // SERIALIZABLE Properties |
19 | value: null | 19 | ////////////////////////////// |
20 | rulerTop: { | ||
21 | value: null, | ||
22 | serializable: true | ||
23 | }, | ||
24 | |||
25 | rulerLeft: { | ||
26 | value: null, | ||
27 | serializable: true | ||
28 | }, | ||
29 | |||
30 | appModel: { | ||
31 | value: null, | ||
32 | serializable: true | ||
20 | }, | 33 | }, |
21 | 34 | ||
22 | toolsData: { | 35 | toolsData: { |
23 | value: null | 36 | value: null, |
37 | serializable: true | ||
24 | }, | 38 | }, |
25 | 39 | ||
26 | appData: { | 40 | toolsList: { |
27 | value: AppData | 41 | value: null, |
42 | serializable: true | ||
43 | }, | ||
44 | |||
45 | toolsProperties: { | ||
46 | value: null, | ||
47 | serializable: true | ||
48 | }, | ||
49 | |||
50 | stage: { | ||
51 | value: null, | ||
52 | serializable: true | ||
53 | }, | ||
54 | |||
55 | elementMediator: { | ||
56 | value: null, | ||
57 | serializable: true | ||
58 | }, | ||
59 | |||
60 | dragDropMediator: { | ||
61 | value: null, | ||
62 | serializable: true | ||
63 | }, | ||
64 | |||
65 | undocontroller: { | ||
66 | value: null, | ||
67 | serializable: true | ||
68 | }, | ||
69 | |||
70 | selectionController: { | ||
71 | value: null, | ||
72 | serializable: true | ||
73 | }, | ||
74 | |||
75 | documentController: { | ||
76 | value: null, | ||
77 | serializable: true | ||
78 | }, | ||
79 | |||
80 | popupManager: { | ||
81 | value: null, | ||
82 | serializable: true | ||
83 | }, | ||
84 | |||
85 | colorController: { | ||
86 | value: null, | ||
87 | serializable: true | ||
88 | }, | ||
89 | |||
90 | stylesController: { | ||
91 | value: null, | ||
92 | serializable: true | ||
93 | }, | ||
94 | |||
95 | presetsController: { | ||
96 | value: null, | ||
97 | serializable: true | ||
98 | }, | ||
99 | |||
100 | filePickerController: { | ||
101 | value: null, | ||
102 | serializable: true | ||
103 | }, | ||
104 | |||
105 | newFileController: { | ||
106 | value: null, | ||
107 | serializable: true | ||
108 | }, | ||
109 | |||
110 | coreIoApi: { | ||
111 | value: null, | ||
112 | serializable: true | ||
113 | }, | ||
114 | |||
115 | documentBar: { | ||
116 | value: null, | ||
117 | serializable: true | ||
118 | }, | ||
119 | |||
120 | editorViewOptions: { | ||
121 | value: null, | ||
122 | serializable: true | ||
123 | }, | ||
124 | |||
125 | ioMediator: { | ||
126 | value: null, | ||
127 | serializable: true | ||
128 | }, | ||
129 | |||
130 | timeline: { | ||
131 | value: null, | ||
132 | serializable: true | ||
133 | }, | ||
134 | |||
135 | mainMenuController: { | ||
136 | value: null, | ||
137 | serializable: true | ||
138 | }, | ||
139 | |||
140 | codeEditorController: { | ||
141 | value: null, | ||
142 | serializable: true | ||
143 | }, | ||
144 | |||
145 | rightPanelContainer: { | ||
146 | value: null, | ||
147 | serializable: true | ||
148 | }, | ||
149 | |||
150 | panelSplitter: { | ||
151 | value: null, | ||
152 | serializable: true | ||
153 | }, | ||
154 | |||
155 | timelineSplitter: { | ||
156 | value: null, | ||
157 | serializable: true | ||
158 | }, | ||
159 | |||
160 | toolsSplitter: { | ||
161 | value: null, | ||
162 | serializable: true | ||
163 | }, | ||
164 | |||
165 | optionsSplitter: { | ||
166 | value: null, | ||
167 | serializable: true | ||
28 | }, | 168 | }, |
29 | 169 | ||
30 | documentList: { | 170 | documentList: { |
171 | value: null, | ||
172 | serializable: true | ||
173 | }, | ||
174 | ////////////////////////////// | ||
175 | |||
176 | ninjaVersion: { | ||
31 | value: null | 177 | value: null |
32 | }, | 178 | }, |
33 | 179 | ||
180 | appData: { | ||
181 | value: AppData | ||
182 | }, | ||
183 | |||
34 | currentDocument: { | 184 | currentDocument: { |
35 | get: function() { | 185 | get: function() { |
36 | if(this.documentList.selectedObjects) { | 186 | if(this.documentList.selectedObjects) { |
@@ -171,21 +321,6 @@ exports.Ninja = Montage.create(Component, { | |||
171 | value: [] | 321 | value: [] |
172 | }, | 322 | }, |
173 | 323 | ||
174 | _currentSelectedContainer: { | ||
175 | value: null | ||
176 | }, | ||
177 | |||
178 | currentSelectedContainer: { | ||
179 | get: function() { | ||
180 | return this._currentSelectedContainer; | ||
181 | }, | ||
182 | set: function(value) { | ||
183 | if(value !== this._currentSelectedContainer) { | ||
184 | this._currentSelectedContainer = value; | ||
185 | } | ||
186 | } | ||
187 | }, | ||
188 | |||
189 | templateDidLoad: { | 324 | templateDidLoad: { |
190 | value: function() { | 325 | value: function() { |
191 | this.ninjaVersion = window.ninjaVersion.ninja.version; | 326 | this.ninjaVersion = window.ninjaVersion.ninja.version; |
@@ -209,6 +344,10 @@ exports.Ninja = Montage.create(Component, { | |||
209 | this.setupGlobalHelpers(); | 344 | this.setupGlobalHelpers(); |
210 | 345 | ||
211 | window.addEventListener("resize", this, false); | 346 | window.addEventListener("resize", this, false); |
347 | //Prompting the user to make sure data was saved before closing Ninja | ||
348 | window.onbeforeunload = function () { | ||
349 | return 'Are you sure you want to close Ninja? Any unsaved data will be lost.'; | ||
350 | }; | ||
212 | 351 | ||
213 | this.eventManager.addEventListener("selectTool", this, false); | 352 | this.eventManager.addEventListener("selectTool", this, false); |
214 | this.eventManager.addEventListener("selectSubTool", this, false); | 353 | this.eventManager.addEventListener("selectSubTool", this, false); |
@@ -342,15 +481,9 @@ exports.Ninja = Montage.create(Component, { | |||
342 | openDocument: { | 481 | openDocument: { |
343 | value: function(doc) { | 482 | value: function(doc) { |
344 | this.documentList.content.push(doc); | 483 | this.documentList.content.push(doc); |
345 | // This is not needed with the latest 0.10 montage. | 484 | // TODO: Check why this is still needed |
346 | // TODO: Remove this when integrating the next montage | ||
347 | this.documentList.selectedObjects = [doc]; | 485 | this.documentList.selectedObjects = [doc]; |
348 | 486 | ||
349 | if(doc.currentView === "design") { | ||
350 | // TODO: Bind directly to the model of the document in components instead of this property | ||
351 | this._currentSelectedContainer = null; | ||
352 | this.currentSelectedContainer = doc.model.documentRoot; | ||
353 | } | ||
354 | } | 487 | } |
355 | }, | 488 | }, |
356 | 489 | ||