From 792c83a0fe8f7f22d139684ed6d711a2c334c098 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 17 May 2012 16:55:19 -0700 Subject: Adding component initialization on open This is for opening components, selection is still not reflecting component data. --- js/document/views/design.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'js/document/views') diff --git a/js/document/views/design.js b/js/document/views/design.js index 2ccb82d1..bd8c25ec 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -184,8 +184,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { this._bodyFragment = null; //Calling standard method to finish opening document this.bodyContentLoaded(null); - - // TODO: Clean up this code + //TODO: Move this to be set via the controller this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2); this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2); } @@ -243,17 +242,15 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { } } } - //Checking and initializing webGL + //Checking for script tags then parsing check for montage and webgl if (scripttags.length > 0) { + //Checking and initializing webGL this.initWebGl(scripttags); - } //Else there is not data to parse - - - - //TODO: Load Montage Components (blocking) - //this.initMontage(); - - + //Checking and initializing Montage + this.initMontage(scripttags); + } else { + //Else there is not data to parse + } //Makign callback if specified if (this._callback) this._callback(); } @@ -350,8 +347,14 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { //////////////////////////////////////////////////////////////////// // initMontage: { - value: function () { - //initWithDocument(window.document) instantiateWithOwnerAndDocument(null, window.document) + value: function (scripttags) { + // + this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { + //Initializing template with user's seriliazation + var template = this.iframe.contentWindow.mjsTemplate.create(); + template.initWithDocument(this.iframe.contentWindow.document); + template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (e){/*Nothing just a required extra parameter*/}); + }.bind(this), false); } }, //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From fdfba499f0b84360b96096fa866a981e96e8756c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 16:35:56 -0700 Subject: fixing the color chip for the document root Signed-off-by: Valerio Virgillito --- js/document/views/design.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'js/document/views') diff --git a/js/document/views/design.js b/js/document/views/design.js index 2ccb82d1..44f1a5e8 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -64,6 +64,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { }, //////////////////////////////////////////////////////////////////// // + propertiesPanel: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // initialize: { value: function (parent) { //Creating iFrame for view -- cgit v1.2.3 From 7a22f7b368ef549a5b30c58a0f3900685b764bdb Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 18 May 2012 16:56:16 -0700 Subject: integrated open code view document in new dom architecture Signed-off-by: Ananya Sen --- js/document/views/code.js | 193 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 190 insertions(+), 3 deletions(-) (limited to 'js/document/views') diff --git a/js/document/views/code.js b/js/document/views/code.js index cd3e02d4..de12881c 100755 --- a/js/document/views/code.js +++ b/js/document/views/code.js @@ -11,15 +11,202 @@ var Montage = require("montage/core/core").Montage, BaseDocumentView = require("js/document/views/base").BaseDocumentView; //////////////////////////////////////////////////////////////////////// // -exports.CodeDocumentView = Montage.create(BaseDocumentView, { +var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentView, { //////////////////////////////////////////////////////////////////// // hasTemplate: { enumerable: false, value: false + }, + + //////////////////////////////////////////////////////////////////// + // + _editor: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // + editor: { + get: function() {return this._editor;}, + set: function(value) {this._editor= value;} + }, + //////////////////////////////////////////////////////////////////// + // + _textArea: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // + textArea: { + get: function() {return this._textArea;}, + set: function(value) {this._textArea= value;} + }, + + //////////////////////////////////////////////////////////////////// + //remove _extParentContainer after moving to bucket structure for documents + _textParentContainer: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // + textParentContainer: { + get: function() {return this._textParentContainer;}, + set: function(value) {this._textParentContainer= value;} + }, + //////////////////////////////////////////////////////////////////// + // + _textViewContainer: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // + textViewContainer: { + get: function() {return this._textViewContainer;}, + set: function(value) {this._textViewContainer= value;} + }, + //////////////////////////////////////////////////////////////////// + // + + /** + * Public method + */ + initialize:{ + value: function(){ + //populate _textParentContainer + this.textParentContainer = document.getElementById("codeViewContainer"); + + //create contianer + this.textViewContainer = document.createElement("div"); + //this.textViewContainer.id = "codemirror_" + uuid; + this.textViewContainer.style.display = "block"; + this.textParentContainer.appendChild(this.textViewContainer); + + //create text area + this.textArea = this.createTextAreaElement(); + } + }, + + /** + * Public method + * Creates a textarea element which will contain the content of the opened text document. + */ + createTextAreaElement: { + value: function() { + var textArea = document.createElement("textarea"); +// textArea.id = "code"; +// textArea.name = "code"; + this.textViewContainer.appendChild(textArea); + + return textArea; + } + }, + //////////////////////////////////////////////////////////////////// + // + /** + * Public method + * Creates a new instance of a code editor + */ + initializeTextView: { + value: function(file, textDocument) { + var type; + + if(this.activeDocument) { + //need to hide only if another document was open before +// this.application.ninja.documentController._hideCurrentDocument(); +// this.hideOtherDocuments(doc.uuid); + } + + switch(file.extension) { + case "css" : + type = "css"; + break; + case "js" : + type = "javascript"; + break; + case "html" : + type = "htmlmixed"; + break; + case "json" : + type = "javascript"; + break; + case "php" : + type = "php"; + break; + case "pl" : + type = "perl"; + break; + case "py" : + type = "python"; + break; + case "rb" : + type = "ruby"; + break; + case "xml" : + type = "xml"; + break; + } + this.textViewContainer.style.display="block"; + + this.editor = this.application.ninja.codeEditorController.createEditor(this, type, file.extension, textDocument); + this.editor.hline = this.editor.setLineClass(0, "activeline"); + + + } + }, + //////////////////////////////////////////////////////////////////// + // + + showRulers:{ + value:function(){ + this.application.ninja.rulerTop.style.display = "block"; + this.application.ninja.rulerLeft.style.display = "block"; + } + }, + hideRulers:{ + value:function(){ + this.application.ninja.rulerTop.style.display = "none"; + this.application.ninja.rulerLeft.style.display = "none"; + } + }, + showCodeViewBar:{ + value:function(isCodeView){ + if(isCodeView === true) { + this.application.ninja.editorViewOptions.element.style.display = "block"; + this.application.ninja.documentBar.element.style.display = "none"; + } else { + this.application.ninja.documentBar.element.style.display = "block"; + this.application.ninja.editorViewOptions.element.style.display = "none"; + } + } + }, + + collapseAllPanels:{ + value:function(){ + this.application.ninja.panelSplitter.collapse(); + this.application.ninja.timelineSplitter.collapse(); + this.application.ninja.toolsSplitter.collapse(); + this.application.ninja.optionsSplitter.collapse(); + } + }, + restoreAllPanels:{ + value:function(){ + this.application.ninja.panelSplitter.restore(); + this.application.ninja.timelineSplitter.restore(); + this.application.ninja.toolsSplitter.restore(); + this.application.ninja.optionsSplitter.restore(); + } + }, + + applyTheme:{ + value:function(themeClass){ + //Todo: change for bucket structure of documents + this.textParentContainer.className = "codeViewContainer "+themeClass; + } } - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// }); //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// \ No newline at end of file -- cgit v1.2.3 From c3c2ffc8d057660b7c42b45442885cd0d2d598bc Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Sun, 20 May 2012 15:16:06 -0700 Subject: use documents parent container property Signed-off-by: Ananya Sen --- js/document/views/code.js | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'js/document/views') diff --git a/js/document/views/code.js b/js/document/views/code.js index de12881c..711479a8 100755 --- a/js/document/views/code.js +++ b/js/document/views/code.js @@ -41,18 +41,6 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie get: function() {return this._textArea;}, set: function(value) {this._textArea= value;} }, - - //////////////////////////////////////////////////////////////////// - //remove _extParentContainer after moving to bucket structure for documents - _textParentContainer: { - value: null - }, - //////////////////////////////////////////////////////////////////// - // - textParentContainer: { - get: function() {return this._textParentContainer;}, - set: function(value) {this._textParentContainer= value;} - }, //////////////////////////////////////////////////////////////////// // _textViewContainer: { @@ -71,15 +59,12 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie * Public method */ initialize:{ - value: function(){ - //populate _textParentContainer - this.textParentContainer = document.getElementById("codeViewContainer"); - + value: function(parentContainer){ //create contianer this.textViewContainer = document.createElement("div"); //this.textViewContainer.id = "codemirror_" + uuid; this.textViewContainer.style.display = "block"; - this.textParentContainer.appendChild(this.textViewContainer); + parentContainer.appendChild(this.textViewContainer); //create text area this.textArea = this.createTextAreaElement(); @@ -200,7 +185,7 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie applyTheme:{ value:function(themeClass){ //Todo: change for bucket structure of documents - this.textParentContainer.className = "codeViewContainer "+themeClass; + this.textViewContainer.className = "codeViewContainer "+themeClass; } } -- cgit v1.2.3 From 2cc8e58f6bb9f64a7473e62aecd013fa55167231 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 21 May 2012 16:42:26 -0700 Subject: - added opening multiple code and design view documents - switching between multiple code and design view documents - Note: closing of documents, when multiple documents are open, is not yet implemented Signed-off-by: Ananya Sen --- js/document/views/code.js | 54 ++++++++++++----------------------------------- 1 file changed, 14 insertions(+), 40 deletions(-) (limited to 'js/document/views') diff --git a/js/document/views/code.js b/js/document/views/code.js index 711479a8..66d1c702 100755 --- a/js/document/views/code.js +++ b/js/document/views/code.js @@ -140,56 +140,30 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie }, //////////////////////////////////////////////////////////////////// // - - showRulers:{ - value:function(){ - this.application.ninja.rulerTop.style.display = "block"; - this.application.ninja.rulerLeft.style.display = "block"; - } - }, - hideRulers:{ - value:function(){ - this.application.ninja.rulerTop.style.display = "none"; - this.application.ninja.rulerLeft.style.display = "none"; - } - }, - showCodeViewBar:{ - value:function(isCodeView){ - if(isCodeView === true) { - this.application.ninja.editorViewOptions.element.style.display = "block"; - this.application.ninja.documentBar.element.style.display = "none"; - } else { - this.application.ninja.documentBar.element.style.display = "block"; - this.application.ninja.editorViewOptions.element.style.display = "none"; - } - } - }, - - collapseAllPanels:{ - value:function(){ - this.application.ninja.panelSplitter.collapse(); - this.application.ninja.timelineSplitter.collapse(); - this.application.ninja.toolsSplitter.collapse(); - this.application.ninja.optionsSplitter.collapse(); + show: { + value: function (callback) { + this.textViewContainer.style.display = "block"; + // + if (callback) callback(); } }, - restoreAllPanels:{ - value:function(){ - this.application.ninja.panelSplitter.restore(); - this.application.ninja.timelineSplitter.restore(); - this.application.ninja.toolsSplitter.restore(); - this.application.ninja.optionsSplitter.restore(); + //////////////////////////////////////////////////////////////////// + // + hide: { + value: function (callback) { + this.textViewContainer.style.display = "none"; + // + if (callback) callback(); } }, - + //////////////////////////////////////////////////////////////////// + // applyTheme:{ value:function(themeClass){ //Todo: change for bucket structure of documents this.textViewContainer.className = "codeViewContainer "+themeClass; } } - - //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// }); -- cgit v1.2.3 From ff57e780d17e35dfdbfa6044bc0416145851f5c9 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 22 May 2012 00:03:32 -0700 Subject: Adding support for reading webgl external files For author-time, run-time is already checked in and supported. --- js/document/views/design.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'js/document/views') diff --git a/js/document/views/design.js b/js/document/views/design.js index 3f58650e..76a36323 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -324,7 +324,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { initWebGl: { value: function (scripttags) { // - var n, webgldata; + var n, webgldata, fileRead; //Setting the iFrame property for reference in helper class this.model.webGlHelper.iframe = this.model.views.design.iframe; //Checking for webGL Data @@ -336,6 +336,15 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { if (scripttags[w].getAttribute('data-ninja-webgl') !== null) { //TODO: Add logic to handle more than one data tag webgldata = JSON.parse((scripttags[w].innerHTML.replace("(", "")).replace(")", "")); + } else if (scripttags[w].getAttribute('data-ninja-canvas-json') !== null) { + //TODO: Add check for hardcoded URL + fileRead = this.application.ninja.ioMediator.fio.readFile({uri: this.application.ninja.documentController.documentHackReference.root+scripttags[w].getAttribute('data-ninja-canvas-json')}); + // + if (fileRead.status === 204) { + webgldata = JSON.parse((fileRead.file.content.replace("(", "")).replace(")", "")); + } else { + //Error + } } //Checking for webGL data and building data array if (webgldata && webgldata.data) { -- cgit v1.2.3 From c4435b596cd01aaec3427b6d9390bf6062d77f0c Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 22 May 2012 00:08:03 -0700 Subject: Minor bug fix No longer using webgl attribute names, instead using canvas to be more consistent and allow for better term usage across canvas 2D and RDGE. --- js/document/views/design.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/document/views') diff --git a/js/document/views/design.js b/js/document/views/design.js index 76a36323..b3887fdf 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -333,7 +333,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { webgldata = null; //Checking for tags with webGL data if (scripttags[w].getAttribute) { - if (scripttags[w].getAttribute('data-ninja-webgl') !== null) { + if (scripttags[w].getAttribute('data-ninja-canvas') !== null) { //TODO: Add logic to handle more than one data tag webgldata = JSON.parse((scripttags[w].innerHTML.replace("(", "")).replace(")", "")); } else if (scripttags[w].getAttribute('data-ninja-canvas-json') !== null) { -- cgit v1.2.3 From 9b6da637d9654727426c6d78f17e3804bbd84ce5 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 22 May 2012 14:42:43 -0700 Subject: fixing a few document switching issues. Signed-off-by: Valerio Virgillito --- js/document/views/base.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/document/views') diff --git a/js/document/views/base.js b/js/document/views/base.js index d1c65b5e..db72cc60 100755 --- a/js/document/views/base.js +++ b/js/document/views/base.js @@ -39,6 +39,7 @@ exports.BaseDocumentView = Montage.create(Component, { value: function (callback) { if (this.iframe) { this.iframe.style.display = 'block'; + this.iframe.style.opacity = 1; } else { console.log('Error: View has no iframe to show!'); } @@ -52,6 +53,7 @@ exports.BaseDocumentView = Montage.create(Component, { value: function (callback) { if (this.iframe) { this.iframe.style.display = 'none'; + this.iframe.style.opacity = 0; } else { console.log('Error: View has no iframe to hide!'); } -- cgit v1.2.3