aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js2
-rwxr-xr-xjs/controllers/document-controller.js21
-rwxr-xr-xjs/document/document-html.js21
-rwxr-xr-xjs/models/app-model.js26
-rwxr-xr-xjs/ninja.reel/ninja.html5
-rwxr-xr-xjs/ninja.reel/ninja.js8
6 files changed, 31 insertions, 52 deletions
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
index e4d622e3..dabce6e0 100644
--- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
+++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
@@ -12,7 +12,7 @@ var Montage = require("montage/core/core").Montage,
12exports.CodeEditorViewOptions = Montage.create(Component, { 12exports.CodeEditorViewOptions = Montage.create(Component, {
13 13
14 _currentDocument: { 14 _currentDocument: {
15 value : null 15 value : null
16 }, 16 },
17 17
18 currentDocument : { 18 currentDocument : {
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 0fe1636a..a90375af 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -348,26 +348,5 @@ exports.DocumentController = Montage.create(Component, {
348 value: function(document) { 348 value: function(document) {
349 document.closeDocument(this.application.ninja, this.application.ninja.closeFile); 349 document.closeDocument(this.application.ninja, this.application.ninja.closeFile);
350 } 350 }
351 },
352
353 switchDocuments: {
354 value: function(currentDocument, newDocument, didCreate) {
355
356 if(currentDocument.currentView === "design") {
357 currentDocument.serializeDocument();
358 }
359
360 if(didCreate) {
361 if(newDocument.currentView === "design") {
362
363 } else {
364 newDocument.model.parentContainer.style["display"] = "block";
365 }
366 } else {
367 if(newDocument.currentView === "design") {
368 newDocument.deserializeDocument();
369 }
370 }
371 }
372 } 351 }
373}); 352});
diff --git a/js/document/document-html.js b/js/document/document-html.js
index c60a12a2..8cc61026 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -117,10 +117,6 @@ exports.HtmlDocument = Montage.create(Component, {
117 // 117 //
118 serializeDocument: { 118 serializeDocument: {
119 value: function () { 119 value: function () {
120 // There are not needed for now since we cannot change them
121 //this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing;
122 //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing;
123
124 // Serialize the current scroll position 120 // Serialize the current scroll position
125 //TODO: Move these properties to the design view class 121 //TODO: Move these properties to the design view class
126 this.model.scrollLeft = this.application.ninja.stage._scrollLeft; 122 this.model.scrollLeft = this.application.ninja.stage._scrollLeft;
@@ -132,11 +128,6 @@ exports.HtmlDocument = Montage.create(Component, {
132 // Serialize the selection, the container and grid 128 // Serialize the selection, the container and grid
133 //TODO: Move this property to the design view class 129 //TODO: Move this property to the design view class
134 this.model.selection = this.application.ninja.selectedElements.slice(0); 130 this.model.selection = this.application.ninja.selectedElements.slice(0);
135 this.model.selectionContainer = this.application.ninja.currentSelectedContainer;
136 this.draw3DGrid = this.application.ninja.appModel.show3dGrid;
137
138 // Serialize the undo
139 // TODO: Save the montage undo queue
140 131
141 // Pause the videos 132 // Pause the videos
142 //TODO: Move these to be handled on the show/hide methods in the view 133 //TODO: Move these to be handled on the show/hide methods in the view
@@ -147,27 +138,15 @@ exports.HtmlDocument = Montage.create(Component, {
147 // 138 //
148 deserializeDocument: { 139 deserializeDocument: {
149 value: function () { 140 value: function () {
150 // There are not needed for now since we cannot change them
151 //this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing;
152 //this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
153
154 // Deserialize the current scroll position 141 // Deserialize the current scroll position
155 //TODO: Move these properties to the design view class 142 //TODO: Move these properties to the design view class
156 this.application.ninja.stage._scrollLeft = this.model.scrollLeft; 143 this.application.ninja.stage._scrollLeft = this.model.scrollLeft;
157 this.application.ninja.stage._scrollTop = this.model.scrollTop; 144 this.application.ninja.stage._scrollTop = this.model.scrollTop;
158 this.application.ninja.stage._userContentLeft = this.model.userContentLeft; 145 this.application.ninja.stage._userContentLeft = this.model.userContentLeft;
159 this.application.ninja.stage._userContentTop = this.model.userContentTop; 146 this.application.ninja.stage._userContentTop = this.model.userContentTop;
160
161 //TODO: Move this property to the design view class
162 this.application.ninja.selectedElements = this.model.selection.slice(0);
163// this.application.ninja.currentSelectedContainer = this.model.selectionContainer;
164 this.application.ninja.appModel.show3dGrid = this.draw3DGrid;
165 147
166 // Serialize the undo 148 // Serialize the undo
167 // TODO: Save the montage undo queue 149 // TODO: Save the montage undo queue
168
169 //TODO: Move this to the document controller
170 this.model.isActive = true;
171 } 150 }
172 } 151 }
173 //////////////////////////////////////////////////////////////////// 152 ////////////////////////////////////////////////////////////////////
diff --git a/js/models/app-model.js b/js/models/app-model.js
index 1c599a32..ceba653e 100755
--- a/js/models/app-model.js
+++ b/js/models/app-model.js
@@ -9,6 +9,32 @@ var Montage = require("montage/core/core").Montage,
9 9
10exports.AppModel = Montage.create(Component, { 10exports.AppModel = Montage.create(Component, {
11 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 if(this._currentDocument && this._currentDocument.currentView === "design") {
26 this._currentDocument.model.draw3DGrid = this.show3dGrid;
27 }
28
29 this._currentDocument = value;
30
31 if(this._currentDocument && this._currentDocument.currentView === "design") {
32 this.show3dGrid = this._currentDocument.model.draw3DGrid;
33 }
34
35 }
36 },
37
12 _livePreview: { 38 _livePreview: {
13 value: false 39 value: false
14 }, 40 },
diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html
index a6422f6e..0c0944e7 100755
--- a/js/ninja.reel/ninja.html
+++ b/js/ninja.reel/ninja.html
@@ -25,7 +25,10 @@
25 }, 25 },
26 26
27 "appModel": { 27 "appModel": {
28 "prototype": "js/models/app-model" 28 "prototype": "js/models/app-model",
29 "bindings": {
30 "currentDocument": {"<-": "@documentList.selectedObjects.0"}
31 }
29 }, 32 },
30 33
31 "materialsModel": { 34 "materialsModel": {
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js
index e9e1e31c..9593973e 100755
--- a/js/ninja.reel/ninja.js
+++ b/js/ninja.reel/ninja.js
@@ -296,9 +296,6 @@ exports.Ninja = Montage.create(Component, {
296 296
297 openDocument: { 297 openDocument: {
298 value: function(doc) { 298 value: function(doc) {
299
300
301
302 this.documentList.content.push(doc); 299 this.documentList.content.push(doc);
303 // This is not needed with the latest 0.10 montage. 300 // This is not needed with the latest 0.10 montage.
304 // TODO: Remove this when integrating the next montage 301 // TODO: Remove this when integrating the next montage
@@ -308,11 +305,6 @@ exports.Ninja = Montage.create(Component, {
308 // TODO: Bind directly to the model of the document in components instead of this property 305 // TODO: Bind directly to the model of the document in components instead of this property
309 this.currentSelectedContainer = doc.model.documentRoot; 306 this.currentSelectedContainer = doc.model.documentRoot;
310 } 307 }
311
312
313// this.appModel.show3dGrid = this.currentDocument.draw3DGrid;
314
315
316 } 308 }
317 }, 309 },
318 310