From 4c3aac5eabd93052b1554a03d78235215bb49db4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 00:34:40 -0700 Subject: document bindings phase 1 - using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index d0eb1557..0b4fd14d 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -18,12 +18,33 @@ exports.Ninja = Montage.create(Component, { value: null }, - toolsData: { value: null }, - appData: { value: AppData }, + toolsData: { + value: null + }, + + appData: { + value: AppData + }, + /* currentDocument: { value: null }, + */ + + documentList: { + value: null + }, + + currentDocument: { + get: function() { + if(this.documentList.selectedObjects) { + return this.documentList.selectedObjects[0]; + } else { + return null; + } + } + }, _isResizing: { value: null @@ -55,9 +76,10 @@ exports.Ninja = Montage.create(Component, { } }, - _resizedWidth : { + _resizedWidth: { value: 0 }, + _width: { value: null }, @@ -174,7 +196,6 @@ exports.Ninja = Montage.create(Component, { this.eventManager.addEventListener("selectTool", this, false); this.eventManager.addEventListener("selectSubTool", this, false); - this.eventManager.addEventListener("onOpenDocument", this, false); this.eventManager.addEventListener("onSwitchDocument", this, false); this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); @@ -190,7 +211,7 @@ exports.Ninja = Montage.create(Component, { //TODO: Expand method to allow other browsers for preview executeChromePreview: { value: function () { - this.application.ninja.documentController.activeDocument.model.browserPreview('chrome'); + this.currentDocument.model.browserPreview('chrome'); } }, //////////////////////////////////////////////////////////////////// @@ -276,7 +297,22 @@ exports.Ninja = Montage.create(Component, { }, handleOnOpenDocument: { - value: function(event) { + value: function(doc) { + + + + this.documentList.content.push(doc); + // This is not needed with the latest 0.10 montage. + // TODO: Remove this when integrating the next montage + this.documentList.selectedObjects = [doc]; + + // TODO: Find a better place for this + doc.model.currentView.show(); + + // TODO: Bind directly to the model of the document in components instead of this property + this.currentSelectedContainer = doc.model.documentRoot; + + /* this.currentDocument = event.detail; if(this.currentDocument.model.documentRoot) { @@ -288,6 +324,8 @@ exports.Ninja = Montage.create(Component, { this.appModel.show3dGrid = this.currentDocument.draw3DGrid; NJevent("openDocument"); + */ + } }, -- cgit v1.2.3 From 5d7dff15e1e603e3b37057b9843e4b1eef1b2dca Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 15:32:47 -0700 Subject: cleanup and handling the document views in the document controller for now. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 0b4fd14d..3659f1f8 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -296,7 +296,7 @@ exports.Ninja = Montage.create(Component, { } }, - handleOnOpenDocument: { + openDocument: { value: function(doc) { @@ -306,25 +306,18 @@ exports.Ninja = Montage.create(Component, { // TODO: Remove this when integrating the next montage this.documentList.selectedObjects = [doc]; - // TODO: Find a better place for this - doc.model.currentView.show(); - // TODO: Bind directly to the model of the document in components instead of this property this.currentSelectedContainer = doc.model.documentRoot; - /* - this.currentDocument = event.detail; - - if(this.currentDocument.model.documentRoot) { - this.currentSelectedContainer = this.currentDocument.model.documentRoot; - } else { - alert("The current document has not loaded yet"); - return; - } +// if(this.currentDocument.model.documentRoot) { +// this.currentSelectedContainer = this.currentDocument.model.documentRoot; +// } else { +// alert("The current document has not loaded yet"); +// return; +// } - this.appModel.show3dGrid = this.currentDocument.draw3DGrid; - NJevent("openDocument"); - */ +// this.appModel.show3dGrid = this.currentDocument.draw3DGrid; +// NJevent("openDocument"); } }, -- cgit v1.2.3 From 31b094ee21102f99a4021d505bc3a28527c9e23d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 01:33:20 -0700 Subject: Fixing the close document. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 3659f1f8..987c32fd 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -322,6 +322,14 @@ exports.Ninja = Montage.create(Component, { } }, + closeFile: { + value: function(document) { + var doc = this.documentList.content[this.documentList.content.indexOf(document)]; + + this.documentList.removeObjects(doc); + } + }, + handleOnSwitchDocument: { value: function() { this.currentDocument = this.documentController.activeDocument; -- cgit v1.2.3 From 0a769756547acb93346d8e1b4126931a78845255 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 17:45:38 -0700 Subject: opening code view documents Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 987c32fd..3c60bb41 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -306,8 +306,10 @@ exports.Ninja = Montage.create(Component, { // TODO: Remove this when integrating the next montage this.documentList.selectedObjects = [doc]; - // TODO: Bind directly to the model of the document in components instead of this property - this.currentSelectedContainer = doc.model.documentRoot; + if(doc.currentView === "design") { + // TODO: Bind directly to the model of the document in components instead of this property + this.currentSelectedContainer = doc.model.documentRoot; + } // if(this.currentDocument.model.documentRoot) { // this.currentSelectedContainer = this.currentDocument.model.documentRoot; -- cgit v1.2.3 From e1fe603a7c002073f8ac13623f8cc8dc43efb59d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 31 May 2012 10:27:46 -0700 Subject: fixing selection when switching documents Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 3c60bb41..4c1efff4 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -151,7 +151,6 @@ exports.Ninja = Montage.create(Component, { } }, - selectedElements: { value: [] }, @@ -196,7 +195,6 @@ exports.Ninja = Montage.create(Component, { this.eventManager.addEventListener("selectTool", this, false); this.eventManager.addEventListener("selectSubTool", this, false); - this.eventManager.addEventListener("onSwitchDocument", this, false); this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); @@ -311,15 +309,9 @@ exports.Ninja = Montage.create(Component, { this.currentSelectedContainer = doc.model.documentRoot; } -// if(this.currentDocument.model.documentRoot) { -// this.currentSelectedContainer = this.currentDocument.model.documentRoot; -// } else { -// alert("The current document has not loaded yet"); -// return; -// } // this.appModel.show3dGrid = this.currentDocument.draw3DGrid; -// NJevent("openDocument"); + } }, @@ -332,18 +324,6 @@ exports.Ninja = Montage.create(Component, { } }, - handleOnSwitchDocument: { - value: function() { - this.currentDocument = this.documentController.activeDocument; - - if(this.currentDocument.model.documentRoot) { - this._currentSelectedContainer = this.selectionController._selectionContainer = this.currentDocument.model.documentRoot; - } - - NJevent("switchDocument"); - } - }, - executeLivePreview: { value: function() { var background, overflow, transitionStopRule; -- cgit v1.2.3 From 3a3a2351ea2d816bf953cbf76622772f7d64aa8b Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 00:16:31 -0700 Subject: fixing the code editor, closing documents and cleanup of the stage Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 4c1efff4..e9e1e31c 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -318,9 +318,19 @@ exports.Ninja = Montage.create(Component, { closeFile: { value: function(document) { - var doc = this.documentList.content[this.documentList.content.indexOf(document)]; + var doc = this.documentList.content[this.documentList.content.indexOf(document)], activeDocument; + + if(this.documentList.selectedObjects[0] === doc) { + activeDocument = this.documentList.content[0]; + } else { + activeDocument = this.documentList.selectedObjects[0]; + } this.documentList.removeObjects(doc); + + if(this.documentList.content.length) { + this.documentList.selectedObjects = [activeDocument]; + } } }, -- cgit v1.2.3 From 7fcb10270f9e19415f8452c261c2d0c86916a29a Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 00:54:02 -0700 Subject: fixed the 3d grid when switching documents and some cleanup Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 8 -------- 1 file changed, 8 deletions(-) (limited to 'js/ninja.reel/ninja.js') 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, { openDocument: { value: function(doc) { - - - this.documentList.content.push(doc); // This is not needed with the latest 0.10 montage. // TODO: Remove this when integrating the next montage @@ -308,11 +305,6 @@ exports.Ninja = Montage.create(Component, { // TODO: Bind directly to the model of the document in components instead of this property this.currentSelectedContainer = doc.model.documentRoot; } - - -// this.appModel.show3dGrid = this.currentDocument.draw3DGrid; - - } }, -- cgit v1.2.3 From 2085c783cf3a75d2b8f0370a6f54f62dd513161c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 11:15:26 -0700 Subject: fixing the document closing when the first document is closed. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 9593973e..ac883923 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -26,12 +26,6 @@ exports.Ninja = Montage.create(Component, { value: AppData }, - /* - currentDocument: { - value: null - }, - */ - documentList: { value: null }, @@ -46,9 +40,6 @@ exports.Ninja = Montage.create(Component, { } }, - _isResizing: { - value: null - }, _resizedHeight : { value: 0 }, @@ -199,8 +190,6 @@ exports.Ninja = Montage.create(Component, { this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); this.addPropertyChangeListener("appModel.debug", this.toggleDebug, false); - - NJevent("appLoading"); } }, @@ -312,16 +301,20 @@ exports.Ninja = Montage.create(Component, { value: function(document) { var doc = this.documentList.content[this.documentList.content.indexOf(document)], activeDocument; - if(this.documentList.selectedObjects[0] === doc) { - activeDocument = this.documentList.content[0]; - } else { + if(this.documentList.selectedObjects[0] !== doc) { activeDocument = this.documentList.selectedObjects[0]; + } else { + activeDocument = null; } this.documentList.removeObjects(doc); - if(this.documentList.content.length) { + if(activeDocument) { this.documentList.selectedObjects = [activeDocument]; + } else { + if(this.documentList.content.length) { + this.documentList.selectedObjects = this.documentList.content[0]; + } } } }, @@ -383,16 +376,6 @@ exports.Ninja = Montage.create(Component, { } }, - getCurrentToolInstance: { - value: function() { - if(this.toolsData.selectedTool.container) { - return this.toolsList[this.toolsData.selectedSubTool.action]; - } else { - return this.toolsList[this.toolsData.selectedTool.action]; - } - } - }, - setupGlobalHelpers: { value: function() { -- cgit v1.2.3 From 75fc82ce49d6f1eb05dc950b46292d42b5856005 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 16:19:04 -0700 Subject: fixing some selection container changes and the breadcrumb not drawing initially Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index ac883923..a12270a0 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -292,6 +292,7 @@ exports.Ninja = Montage.create(Component, { if(doc.currentView === "design") { // TODO: Bind directly to the model of the document in components instead of this property + this._currentSelectedContainer = null; this.currentSelectedContainer = doc.model.documentRoot; } } -- cgit v1.2.3