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/controllers/styles-controller.js | 19 ------------------- js/ninja.reel/ninja.js | 33 ++++++++------------------------- 2 files changed, 8 insertions(+), 44 deletions(-) diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 86df82de..8d56370d 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -48,25 +48,6 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// bind the document to prop w/ setter. The setter calls to find ///// the stage and default css files. - handleAppLoaded : { - value: function() { - ///// Bind app's currentDocument property to - ///// styles controller's _currentDocument property - -// Object.defineBinding(this, "currentDocument", { -// boundObject: this.application.ninja, -// boundObjectPropertyPath: "currentDocument", -// oneway: true -// }); - } - }, - - deserializedFromTemplate : { - value: function() { - this.eventManager.addEventListener( "appLoaded", this, false); - }, - enumerable : false - }, ///// Active document gets automatically set when the ///// document controller changes it _currentDocument : { 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