From 84931583f1da8da29784074978f146b281b8efa3 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Wed, 7 Mar 2012 16:08:36 -0800 Subject: Disabled state for panels Signed-off-by: Armen Kesablyan --- js/panels/PanelContainer.reel/PanelContainer.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'js/panels/PanelContainer.reel/PanelContainer.js') diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js index b285b49d..c40bbc21 100755 --- a/js/panels/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer.reel/PanelContainer.js @@ -47,7 +47,7 @@ exports.PanelContainer = Montage.create(Component, { this['panel_'+i].flexible = p.flexible; this['panel_'+i].modulePath = p.modulePath; this['panel_'+i].moduleName = p.moduleName; - this['panel_'+i].index = i; + this['panel_'+i].disabled = true; this.currentPanelState[p.name] = {}; this.currentPanelState.version = "1.0"; @@ -65,6 +65,8 @@ exports.PanelContainer = Montage.create(Component, { this.application.localStorage.setItem("panels", this.currentPanelState); + this.eventManager.addEventListener( "onOpenDocument", this, false); + this.eventManager.addEventListener( "closeDocument", this, false); } }, @@ -85,6 +87,24 @@ exports.PanelContainer = Montage.create(Component, { this._redrawPanels(null, true); } }, + + handleOnOpenDocument: { + value: function(){ + this.panels.forEach(function(obj) { + obj.disabled = false; + }); + } + }, + + handleCloseDocument: { + value: function(){ + if(!this.application.ninja.documentController.activeDocument) { + this.panels.forEach(function(obj) { + obj.disabled = true; + }); + } + } + }, handleDropped: { value: function(e) { -- cgit v1.2.3