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 --- .../layout/tools-list.reel/tools-list.html | 6 +--- js/components/layout/tools-list.reel/tools-list.js | 39 +++++++++++++++++++--- 2 files changed, 35 insertions(+), 10 deletions(-) (limited to 'js/components/layout/tools-list.reel') diff --git a/js/components/layout/tools-list.reel/tools-list.html b/js/components/layout/tools-list.reel/tools-list.html index df603bf8..4e5b85ee 100755 --- a/js/components/layout/tools-list.reel/tools-list.html +++ b/js/components/layout/tools-list.reel/tools-list.html @@ -102,11 +102,7 @@ "element": {"#": "disabledCondition"} }, "bindings": { - "condition": { - "boundObject": {"@": "owner"}, - "boundObjectPropertyPath": "disabled", - "oneway": true - } + "condition": {"<-": "@owner.disabled"} } }, diff --git a/js/components/layout/tools-list.reel/tools-list.js b/js/components/layout/tools-list.reel/tools-list.js index a10b6c3e..638aea41 100755 --- a/js/components/layout/tools-list.reel/tools-list.js +++ b/js/components/layout/tools-list.reel/tools-list.js @@ -26,11 +26,41 @@ exports.ToolsList = Montage.create(Component, { RotateStageTool3D: { value: null }, PanTool: { value: null }, ZoomTool: { value: null }, - disabled: { value: true}, - handleOpenDocument: { - value: function(){ - this.disabled = false; + _currentDocument: { + enumerable: false, + value: null + }, + + currentDocument: { + enumerable: false, + get: function() { + return this._currentDocument; + }, + set: function(value) { + if (value === this._currentDocument) { + return; + } + + this._currentDocument = value; + + this.disabled = !this._currentDocument; + + } + }, + + _disabled: { + value: true + }, + + disabled: { + get: function() { + return this._disabled; + }, + set: function(value) { + if(value !== this._disabled) { + this._disabled = value; + } } }, @@ -45,7 +75,6 @@ exports.ToolsList = Montage.create(Component, { prepareForDraw: { enumerable: false, value: function() { - this.eventManager.addEventListener( "openDocument", this, false); this.eventManager.addEventListener( "closeDocument", this, false); this.PenTool.options = this.application.ninja.toolsProperties.shapeProperties.lineProperties;//this.application.Ninja.toolsProperties.penProperties; -- 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/components/layout/tools-list.reel/tools-list.js | 9 --------- 1 file changed, 9 deletions(-) (limited to 'js/components/layout/tools-list.reel') diff --git a/js/components/layout/tools-list.reel/tools-list.js b/js/components/layout/tools-list.reel/tools-list.js index 638aea41..c46c065e 100755 --- a/js/components/layout/tools-list.reel/tools-list.js +++ b/js/components/layout/tools-list.reel/tools-list.js @@ -64,18 +64,9 @@ exports.ToolsList = Montage.create(Component, { } }, - handleCloseDocument: { - value: function(){ - if(!this.application.ninja.documentController.activeDocument) { - this.disabled = true; - } - } - }, - prepareForDraw: { enumerable: false, value: function() { - this.eventManager.addEventListener( "closeDocument", this, false); this.PenTool.options = this.application.ninja.toolsProperties.shapeProperties.lineProperties;//this.application.Ninja.toolsProperties.penProperties; this.SelectionTool.options = this.application.ninja.toolsProperties.selectionProperties; -- cgit v1.2.3