From ac750fd9b9c311dcd48c6ee309607edc6fa048e1 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 16 May 2012 14:22:18 -0700 Subject: Adding basic montage components I/O Only for saving basic components without a reel. --- js/document/models/base.js | 6 ++++-- js/document/templates/html/main.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'js/document') diff --git a/js/document/models/base.js b/js/document/models/base.js index 033e16f6..649539ea 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js @@ -149,7 +149,8 @@ exports.BaseDocumentModel = Montage.create(Component, { template: this.fileTemplate, document: this.views.design.iframe.contentWindow.document, head: this.views.design.iframe.contentWindow.document.head, - body: this.views.design.iframe.contentWindow.document.body + body: this.views.design.iframe.contentWindow.document.body, + mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator }, callback.bind(this)); } else { //TODO: Add logic to save code view data @@ -177,7 +178,8 @@ exports.BaseDocumentModel = Montage.create(Component, { template: this.fileTemplate, document: this.views.design.iframe.contentWindow.document, head: this.views.design.iframe.contentWindow.document.head, - body: this.views.design.iframe.contentWindow.document.body + body: this.views.design.iframe.contentWindow.document.body, + mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator }, callback.bind(this)); } else { //TODO: Add logic to save code view data diff --git a/js/document/templates/html/main.js b/js/document/templates/html/main.js index f45657bb..2696dfa0 100644 --- a/js/document/templates/html/main.js +++ b/js/document/templates/html/main.js @@ -42,7 +42,7 @@ exports.Main = Montage.create(Component, { // window.mjsTemplateCreator = TemplateCreator.create(); // - window.mjsTemplate = Template.create(); + window.mjsTemplate = Template.create(); // Dispatch event when this template has loaded. -- cgit v1.2.3 From 5cc5d29736d8bf253e3a168cdd6443e839ffb23c Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 16 May 2012 15:42:09 -0700 Subject: Fixing serialization referencing (new object per save) --- js/document/templates/html/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/document') diff --git a/js/document/templates/html/main.js b/js/document/templates/html/main.js index 2696dfa0..ffa3fab2 100644 --- a/js/document/templates/html/main.js +++ b/js/document/templates/html/main.js @@ -40,9 +40,9 @@ exports.Main = Montage.create(Component, { }; // - window.mjsTemplateCreator = TemplateCreator.create(); + window.mjsTemplateCreator = TemplateCreator; // - window.mjsTemplate = Template.create(); + window.mjsTemplate = Template; // Dispatch event when this template has loaded. -- cgit v1.2.3 From 402a369c7bf164c3c6686be3a33f5e36f25e4130 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 23:19:32 -0700 Subject: document controller and stage view code cleanup Signed-off-by: Valerio Virgillito --- js/document/document-html.js | 21 ++++++++++++++++++--- js/document/html-document.js | 26 -------------------------- js/document/models/html.js | 5 +++++ 3 files changed, 23 insertions(+), 29 deletions(-) (limited to 'js/document') diff --git a/js/document/document-html.js b/js/document/document-html.js index a26b74d5..56d9db02 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -134,14 +134,29 @@ exports.HtmlDocument = Montage.create(Component, { }, //////////////////////////////////////////////////////////////////// // - saveAppState: { + serializeDocument: { value: function () { - //TODO: Import functionality + // There are not needed for now ssince we cannot change them + //this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing; + //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; + + // Serialize the current scroll position + // TODO: Implement + + // Serialize the selection + this.model.selection = this.application.ninja.selectedElements.slice(0); + this.draw3DGrid = this.application.ninja.appModel.show3dGrid; + + // Serialize the undo + // TODO: Save the montage undo queue + + // Pause the videos + this.model.views.design.pauseVideos(); } }, //////////////////////////////////////////////////////////////////// // - restoreAppState: { + deserializeDocument: { value: function () { //TODO: Import functionality } diff --git a/js/document/html-document.js b/js/document/html-document.js index 6a84abdf..68c2a9fb 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -920,32 +920,6 @@ exports.HTMLDocument = Montage.create(TextDocument, { } } }, - //////////////////////////////////////////////////////////////////// - saveAppState:{ - enumerable: false, - value: function () { - - this.savedLeftScroll = this.application.ninja.stage._iframeContainer.scrollLeft; - this.savedTopScroll = this.application.ninja.stage._iframeContainer.scrollTop; - - this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing; - this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; - - if(typeof this.application.ninja.selectedElements !== 'undefined'){ - this.selectionModel = this.application.ninja.selectedElements.slice(0); - } - - this.draw3DGrid = this.application.ninja.appModel.show3dGrid; - - //persist a clone of history per document - this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0); - this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0); - this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start - - //pause videos on switching or closing the document, so that the browser does not keep downloading the media data - this.pauseVideos(); - } - }, //////////////////////////////////////////////////////////////////// restoreAppState:{ diff --git a/js/document/models/html.js b/js/document/models/html.js index b57ff832..67457863 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js @@ -16,6 +16,11 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { // hasTemplate: { value: false + }, + //////////////////////////////////////////////////////////////////// + // + selection: { + value: [] }, //////////////////////////////////////////////////////////////////// // -- cgit v1.2.3