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/bread-crumb.reel/bread-crumb.js | 44 +++++++++++++++++--- .../layout/document-bar.reel/document-bar.html | 6 +-- .../layout/document-bar.reel/document-bar.js | 48 +++++++++++++++++----- .../layout/document-entry.reel/document-entry.css | 22 +++++++--- .../layout/document-entry.reel/document-entry.html | 14 +++++-- .../layout/document-entry.reel/document-entry.js | 44 +++++++------------- .../layout/documents-tab.reel/documents-tab.html | 13 +++--- .../layout/documents-tab.reel/documents-tab.js | 5 +++ .../layout/tools-list.reel/tools-list.html | 6 +-- js/components/layout/tools-list.reel/tools-list.js | 39 +++++++++++++++--- .../tools-properties.reel/tools-properties.js | 42 +++++++++++++++---- 11 files changed, 197 insertions(+), 86 deletions(-) (limited to 'js/components/layout') diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index 49dbe3cb..74e89ac1 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js @@ -9,13 +9,45 @@ var Montage = require("montage/core/core").Montage, exports.Breadcrumb = Montage.create(Component, { - disabled: { + _currentDocument: { + enumerable: false, + value: null + }, + + currentDocument: { + enumerable: false, + get: function() { + return this._currentDocument; + }, + set: function(value) { + if (value === this._currentDocument) { + return; + } + + this._currentDocument = value; + + if(!this._currentDocument) { + this.disabled = true; + } + + this.disabled = this._currentDocument.currentView !== "design"; + + } + }, + + + _disabled: { value: true }, - handleOpenDocument: { - value: function(){ - this.disabled = false; + disabled: { + get: function() { + return this._disabled; + }, + set: function(value) { + if(value !== this._disabled) { + this._disabled = value; + } } }, @@ -50,7 +82,6 @@ exports.Breadcrumb = Montage.create(Component, { prepareForDraw: { value: function() { - this.eventManager.addEventListener("openDocument", this, false); this.eventManager.addEventListener("closeDocument", this, false); this.breadcrumbBt.addEventListener("action", this, false); } @@ -65,7 +96,7 @@ exports.Breadcrumb = Montage.create(Component, { parentNode = this.container; - while(parentNode !== this.application.ninja.currentDocument.model.documentRoot) { + while(parentNode !== this.currentDocument.model.documentRoot) { this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); parentNode = parentNode.parentNode; } @@ -87,6 +118,7 @@ exports.Breadcrumb = Montage.create(Component, { this.containerElements.pop(); } + // TODO: This is bound 2 ways, update the internal property this.application.ninja.currentSelectedContainer = this.containerElements[i].node; } } diff --git a/js/components/layout/document-bar.reel/document-bar.html b/js/components/layout/document-bar.reel/document-bar.html index 760186ba..a35b5590 100755 --- a/js/components/layout/document-bar.reel/document-bar.html +++ b/js/components/layout/document-bar.reel/document-bar.html @@ -37,11 +37,7 @@ "element": {"#": "disabledCondition"} }, "bindings": { - "condition": { - "boundObject": {"@": "owner"}, - "boundObjectPropertyPath": "disabled", - "oneway": true - } + "condition": {"<-": "@owner.disabled"} } }, diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index 56b61f1d..6a7b0f3f 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js @@ -9,13 +9,32 @@ var Component = require("montage/ui/component").Component; exports.DocumentBar = Montage.create(Component, { + _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; + + } + }, + designView: { value: null, enumerable: false}, codeView: { value: null, enumerable: false}, zoomControl: { value: null, enumerable: false }, _type: { enumerable: false, value: null }, - disabled: { value: true }, - - type: { enumerable: false, @@ -86,7 +105,6 @@ exports.DocumentBar = Montage.create(Component, { prepareForDraw: { value: function() { - this.eventManager.addEventListener( "openDocument", this, false); this.eventManager.addEventListener( "closeDocument", this, false); this.designView.addEventListener("click", this, false); this.codeView.addEventListener("click", this, false); @@ -94,6 +112,22 @@ exports.DocumentBar = Montage.create(Component, { } }, + _disabled: { + value: true + }, + + disabled: { + get: function() { + return this._disabled; + }, + set: function(value) { + if(value !== this._disabled) { + this._disabled = value; + } + } + }, + + handleClick: { value: function(event) { if(event._event.target.id === this.currentView) return; @@ -103,12 +137,6 @@ exports.DocumentBar = Montage.create(Component, { } }, - handleOpenDocument: { - value: function() { - this.disabled = false; - } - }, - handleCloseDocument: { value: function() { if(!this.application.ninja.documentController.activeDocument) { diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css index 4601974f..010e1da7 100755 --- a/js/components/layout/document-entry.reel/document-entry.css +++ b/js/components/layout/document-entry.reel/document-entry.css @@ -19,7 +19,20 @@ min-width:0px; } -.documentEntry img { +.mybutton { + display: inline; + -webkit-appearance: none; + outline: none; + + font-size: 9px; + cursor: pointer; + border: 0px; + background-color: #474747; + background-image: -webkit-linear-gradient(top, #505050 0%, #3c3c3c 100%); + +} + +.documentEntry button { opacity: 0.5; /* 50% */ width: 12px; max-width:12px; @@ -29,17 +42,14 @@ transition: opacity 0.2s ease; } -.documentEntry:hover, -.documentEntry:active, -.documentEntry.activeTab { - /*background-color: #7f7f7f; *//* rgb(127, 127, 127); */ +.documentEntry.selected { + background-color:#7F7F7F; } .documentEntry img:hover { opacity: 1.0; /* 100% */ } - .documentEntry span.dirty:before{ content: "*"; display:inline; diff --git a/js/components/layout/document-entry.reel/document-entry.html b/js/components/layout/document-entry.reel/document-entry.html index 679ebb62..bd8c25cb 100755 --- a/js/components/layout/document-entry.reel/document-entry.html +++ b/js/components/layout/document-entry.reel/document-entry.html @@ -15,8 +15,14 @@ "prototype": "js/components/layout/document-entry.reel", "properties": { "element": {"#": "documentEntry"}, - "label": {"#": "name"}, - "activeBack": {"#": "isActive"} + "label": {"#": "name"} + } + }, + + "closeButton": { + "prototype": "montage/ui/button.reel", + "properties": { + "element": {"#": "close-btn"} } } } @@ -24,9 +30,9 @@
  • -
    - + +
  • \ No newline at end of file diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 50b3624c..2e66c7cd 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -58,25 +58,6 @@ exports.DocumentEntry = Montage.create(Component, { } }, - _active: { - enumerable: false, - value: null - }, - - active: { - get: function() { - return this._active; - }, - set: function(value) { - var previousValue = this._active; - this._active = value; - - if (previousValue !== this._active) { - this.needsDraw = true; - } - } - }, - _saveFlag: { value: false }, @@ -96,7 +77,8 @@ exports.DocumentEntry = Montage.create(Component, { prepareForDraw: { enumerable: false, value: function() { - this.element.addEventListener("click", this, false); +// this.element.addEventListener("click", this, false); +// this.closeBtn.addEventListener("click", this, true); } }, @@ -106,7 +88,7 @@ exports.DocumentEntry = Montage.create(Component, { value: function() { this.label.innerText = this._name ? this._name : ""; - this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); +// this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); if(this.saveFlag) { this.label.classList.add("dirty"); @@ -116,15 +98,19 @@ exports.DocumentEntry = Montage.create(Component, { } }, - handleClick: { + captureClick: { value: function(event) { - if(event._event.target.nodeName === "IMG") { - this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); - } else { - if(!this.active) { - this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); - } - } + console.log("clicked on the X"); + event.preventDefault(); + event.stopImmediatePropagation(); + event.stopPropagation(); +// if(event._event.target.nodeName === "IMG") { +// this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); +// } else { +// if(!this.active) { +// this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); +// } +// } } } diff --git a/js/components/layout/documents-tab.reel/documents-tab.html b/js/components/layout/documents-tab.reel/documents-tab.html index 304c8871..04b2bd7b 100755 --- a/js/components/layout/documents-tab.reel/documents-tab.html +++ b/js/components/layout/documents-tab.reel/documents-tab.html @@ -28,22 +28,19 @@ "bindings": { "document": {"<-": "@repetition1.objectAtCurrentIteration"}, "name": {"<-": "@repetition1.objectAtCurrentIteration.model.file.name"}, - "saveFlag": {"<-": "@repetition1.objectAtCurrentIteration.model.needsSave"}, - "active": {"<-": "@repetition1.objectAtCurrentIteration.model.isActive"} + "saveFlag": {"<-": "@repetition1.objectAtCurrentIteration.model.needsSave"} } }, "repetition1": { "prototype": "montage/ui/repetition.reel", "properties": { - "element": {"#": "openDocuments"} + "element": {"#": "openDocuments"}, + "isSelectionEnabled": true }, "bindings": { - "objects": { - "boundObject": {"@": "owner"}, - "boundObjectPropertyPath": "openDocuments", - "oneway": true - } + + "contentController": {"<-": "@owner.contentController"} } } diff --git a/js/components/layout/documents-tab.reel/documents-tab.js b/js/components/layout/documents-tab.reel/documents-tab.js index 982f6ecd..0be639db 100755 --- a/js/components/layout/documents-tab.reel/documents-tab.js +++ b/js/components/layout/documents-tab.reel/documents-tab.js @@ -9,6 +9,7 @@ var Component = require("montage/ui/component").Component; exports.DocumentsTab = Montage.create(Component, { + /* openDocuments: { value: [] }, @@ -40,4 +41,8 @@ exports.DocumentsTab = Montage.create(Component, { } } + */ + contentController: { + value: null + } }); \ No newline at end of file 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; diff --git a/js/components/layout/tools-properties.reel/tools-properties.js b/js/components/layout/tools-properties.reel/tools-properties.js index 47945b58..c25559ae 100755 --- a/js/components/layout/tools-properties.reel/tools-properties.js +++ b/js/components/layout/tools-properties.reel/tools-properties.js @@ -9,10 +9,43 @@ var Component = require("montage/ui/component").Component; exports.ToolsProperties = Montage.create(Component, { - disabled: { + _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; + } + } + }, + handleCloseDocument: { value: function(){ if(!this.application.ninja.documentController.activeDocument) { @@ -21,16 +54,9 @@ exports.ToolsProperties = Montage.create(Component, { } }, - handleOpenDocument: { - value: function() { - this.disabled = false; - } - }, - prepareForDraw: { enumerable: false, value: function() { - this.eventManager.addEventListener( "openDocument", this, false); this.eventManager.addEventListener( "closeDocument", this, false); } }, -- cgit v1.2.3 From 4fa08fe2ce439a5f5c248c568f72d3828ee11b36 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 11:43:55 -0700 Subject: fix for the document tab close button and rulers on initial document Signed-off-by: Valerio Virgillito --- .../layout/document-entry.reel/close_button.gif | Bin 139 -> 0 bytes .../layout/document-entry.reel/document-entry.css | 8 ++--- .../layout/document-entry.reel/document-entry.html | 15 ++++++--- .../layout/document-entry.reel/document-entry.js | 37 ++++----------------- 4 files changed, 20 insertions(+), 40 deletions(-) delete mode 100755 js/components/layout/document-entry.reel/close_button.gif (limited to 'js/components/layout') diff --git a/js/components/layout/document-entry.reel/close_button.gif b/js/components/layout/document-entry.reel/close_button.gif deleted file mode 100755 index 00b5904b..00000000 Binary files a/js/components/layout/document-entry.reel/close_button.gif and /dev/null differ diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css index 010e1da7..6a2900be 100755 --- a/js/components/layout/document-entry.reel/document-entry.css +++ b/js/components/layout/document-entry.reel/document-entry.css @@ -19,17 +19,13 @@ min-width:0px; } -.mybutton { +.documentCloseButton { display: inline; -webkit-appearance: none; outline: none; - - font-size: 9px; cursor: pointer; border: 0px; - background-color: #474747; - background-image: -webkit-linear-gradient(top, #505050 0%, #3c3c3c 100%); - + background: #474747 url(../../../../images/documentsTab/close_button.gif) center center no-repeat; } .documentEntry button { diff --git a/js/components/layout/document-entry.reel/document-entry.html b/js/components/layout/document-entry.reel/document-entry.html index bd8c25cb..e68d17c5 100755 --- a/js/components/layout/document-entry.reel/document-entry.html +++ b/js/components/layout/document-entry.reel/document-entry.html @@ -22,8 +22,16 @@ "closeButton": { "prototype": "montage/ui/button.reel", "properties": { - "element": {"#": "close-btn"} - } + "element": {"#": "close-btn"}, + "identifier": "closeButton" + }, + "listeners": [ + { + "type": "action", + "listener": {"@": "owner"}, + "capture": false + } + ] } } @@ -31,8 +39,7 @@
  • - - +
  • \ No newline at end of file diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 2e66c7cd..34e307cb 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -9,15 +9,11 @@ var Component = require("montage/ui/component").Component; exports.DocumentEntry = Montage.create(Component, { - dirty: { value: null }, - _uuid: { - value: null, - enumerable: false + value: null }, _document: { - enumerable: false, value: null }, @@ -40,7 +36,9 @@ exports.DocumentEntry = Montage.create(Component, { } }, - _name: { value: null }, + _name: { + value: null + }, name: { enumerable: false, @@ -74,22 +72,11 @@ exports.DocumentEntry = Montage.create(Component, { } }, - prepareForDraw: { - enumerable: false, - value: function() { -// this.element.addEventListener("click", this, false); -// this.closeBtn.addEventListener("click", this, true); - } - }, - - draw: { enumerable: false, value: function() { this.label.innerText = this._name ? this._name : ""; -// this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); - if(this.saveFlag) { this.label.classList.add("dirty"); } else { @@ -98,19 +85,9 @@ exports.DocumentEntry = Montage.create(Component, { } }, - captureClick: { - value: function(event) { - console.log("clicked on the X"); - event.preventDefault(); - event.stopImmediatePropagation(); - event.stopPropagation(); -// if(event._event.target.nodeName === "IMG") { -// this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); -// } else { -// if(!this.active) { -// this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); -// } -// } + handleCloseButtonAction: { + value: function() { + //this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); } } -- 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 --- .../layout/document-entry.reel/document-entry.css | 2 +- js/components/layout/tools-list.reel/tools-list.js | 9 --------- .../tools-properties.reel/tools-properties.js | 22 ---------------------- 3 files changed, 1 insertion(+), 32 deletions(-) (limited to 'js/components/layout') diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css index 6a2900be..87880b8d 100755 --- a/js/components/layout/document-entry.reel/document-entry.css +++ b/js/components/layout/document-entry.reel/document-entry.css @@ -42,7 +42,7 @@ background-color:#7F7F7F; } -.documentEntry img:hover { +.documentEntry button:hover { opacity: 1.0; /* 100% */ } 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; diff --git a/js/components/layout/tools-properties.reel/tools-properties.js b/js/components/layout/tools-properties.reel/tools-properties.js index c25559ae..6ea4ad85 100755 --- a/js/components/layout/tools-properties.reel/tools-properties.js +++ b/js/components/layout/tools-properties.reel/tools-properties.js @@ -46,28 +46,6 @@ exports.ToolsProperties = 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); - } - }, - - draw: { - enumerable: false, - value: function() { - //this.selectionProperties.needsDraw = true; - } - }, - _currentSelectedTool : { value: null }, -- 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/components/layout/bread-crumb.reel/bread-crumb.js | 16 +++------------- js/components/layout/document-bar.reel/document-bar.js | 15 --------------- .../layout/document-entry.reel/document-entry.js | 11 +---------- 3 files changed, 4 insertions(+), 38 deletions(-) (limited to 'js/components/layout') diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index 74e89ac1..ac131f2c 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js @@ -26,12 +26,12 @@ exports.Breadcrumb = Montage.create(Component, { this._currentDocument = value; - if(!this._currentDocument) { + if(!value) { this.disabled = true; + } else { + this.disabled = this._currentDocument.currentView !== "design"; } - this.disabled = this._currentDocument.currentView !== "design"; - } }, @@ -51,15 +51,6 @@ exports.Breadcrumb = Montage.create(Component, { } }, - handleCloseDocument: { - value: function(){ - if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") { - this.disabled = true; - this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.model.documentRoot : null); - } - } - }, - _container:{ value:null }, @@ -82,7 +73,6 @@ exports.Breadcrumb = Montage.create(Component, { prepareForDraw: { value: function() { - this.eventManager.addEventListener("closeDocument", this, false); this.breadcrumbBt.addEventListener("action", this, false); } }, diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index 6a7b0f3f..90d3a207 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js @@ -105,7 +105,6 @@ exports.DocumentBar = Montage.create(Component, { prepareForDraw: { value: function() { - this.eventManager.addEventListener( "closeDocument", this, false); this.designView.addEventListener("click", this, false); this.codeView.addEventListener("click", this, false); @@ -135,19 +134,5 @@ exports.DocumentBar = Montage.create(Component, { this.currentView = event._event.target.id; this.application.ninja.documentController.stage.stageView.switchDesignDocViews(event._event.target.id);//switch between design view } - }, - - handleCloseDocument: { - value: function() { - if(!this.application.ninja.documentController.activeDocument) { - this.disabled = true; - } - } - }, - - handleOnDocumentChanged:{ - value:function(event){ - - } } }); diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 34e307cb..94056007 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -9,10 +9,6 @@ var Component = require("montage/ui/component").Component; exports.DocumentEntry = Montage.create(Component, { - _uuid: { - value: null - }, - _document: { value: null }, @@ -23,16 +19,11 @@ exports.DocumentEntry = Montage.create(Component, { return this._document; }, set: function(value) { - if (this._document === value) { return; } this._document = value; - - if(value) { - this._uuid = value.uuid; - } } }, @@ -87,7 +78,7 @@ exports.DocumentEntry = Montage.create(Component, { handleCloseButtonAction: { value: function() { - //this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); + this.application.ninja.documentController.closeFile(this.document); } } -- cgit v1.2.3 From d04aa0b195826b3b3c70f68aa8aba1be9e30a648 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 31 May 2012 10:34:59 -0700 Subject: fixing the close and save Signed-off-by: Valerio Virgillito --- .../layout/documents-tab.reel/documents-tab.js | 34 ---------------------- 1 file changed, 34 deletions(-) (limited to 'js/components/layout') diff --git a/js/components/layout/documents-tab.reel/documents-tab.js b/js/components/layout/documents-tab.reel/documents-tab.js index 0be639db..41c98b30 100755 --- a/js/components/layout/documents-tab.reel/documents-tab.js +++ b/js/components/layout/documents-tab.reel/documents-tab.js @@ -8,40 +8,6 @@ var Montage = require("montage/core/core").Montage; var Component = require("montage/ui/component").Component; exports.DocumentsTab = Montage.create(Component, { - - /* - openDocuments: { - value: [] - }, - - prepareForDraw: { - enumerable: false, - value: function() { -// console.log("Change this to be inside the Ninja Reel"); - this.openDocuments = this.application.ninja.documentController._documents; -// this.eventManager.addEventListener( "appLoaded", this, false); - } - }, - - handleAppLoaded: { - value: function() { -// this.openDocuments = this.application.ninja.currentDocument; - } - }, - - draw: { - enumerable: false, - value: function() { - - } - }, - - handleClick: { - value: function(event) { - - } - } - */ contentController: { value: null } -- cgit v1.2.3 From 6079ceedb5b340c78ecd02f27dfa734eedccf512 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 00:39:14 -0700 Subject: making the document bar handle the current document to hide/show itself Signed-off-by: Valerio Virgillito --- .../layout/document-bar.reel/document-bar.js | 55 +++++++++++++++++++--- 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'js/components/layout') diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index 90d3a207..1cb0bd90 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js @@ -28,13 +28,45 @@ exports.DocumentBar = Montage.create(Component, { this.disabled = !this._currentDocument; + if(this._currentDocument && this._currentDocument.currentView === "design") { + this.visible = true; + } else if(this._currentDocument && this._currentDocument.currentView === "code") { + this.visible = false; + } } }, - designView: { value: null, enumerable: false}, - codeView: { value: null, enumerable: false}, - zoomControl: { value: null, enumerable: false }, - _type: { enumerable: false, value: null }, + _visible: { + value: false + }, + + visible: { + get: function() { + return this._visible; + }, + set: function(value) { + if(this._visible !== value) { + this._visible = value; + this.needsDraw = true; + } + } + }, + + designView: { + value: null + }, + + codeView: { + value: null + }, + + zoomControl: { + value: null + }, + + _type: { + value: null + }, type: { enumerable: false, @@ -50,7 +82,9 @@ exports.DocumentBar = Montage.create(Component, { } }, - _currentView: { value: null, enumerable: false }, + _currentView: { + value: null + }, currentView: { get: function() { return this._currentView}, @@ -64,7 +98,9 @@ exports.DocumentBar = Montage.create(Component, { } }, - _zoomFactor: { value: 100, enumerable: false }, + _zoomFactor: { + value: 100 + }, zoomFactor: { get: function() { return this._zoomFactor; }, @@ -84,6 +120,7 @@ exports.DocumentBar = Montage.create(Component, { draw: { value: function() { + /* if(this.type === "htm" || this.type === "html") { this.designView.classList.add("active"); this.codeView.classList.add("active"); @@ -99,6 +136,12 @@ exports.DocumentBar = Montage.create(Component, { } else if(this.type) { this.designView.classList.remove("active"); } + */ + if(this.visible) { + this.element.style.display = "block"; + } else { + this.element.style.display = "none"; + } } }, -- cgit v1.2.3