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 +++++++++++++++++++--- js/document/models/text.js | 1 - js/stage/stage.reel/stage.js | 13 ----- 3 files changed, 49 insertions(+), 20 deletions(-) (limited to 'js') 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"; + } } }, diff --git a/js/document/models/text.js b/js/document/models/text.js index 0135b9ba..6cb61d48 100755 --- a/js/document/models/text.js +++ b/js/document/models/text.js @@ -60,7 +60,6 @@ exports.TextDocumentModel = Montage.create(BaseDocumentModel, { } // this.parentContainer.removeChild(this.views.code.textViewContainer); - this.application.ninja.stage.showCodeViewBar(false); this.application.ninja.stage.restoreAllPanels(); this.views.code = null; diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index ed716541..d8f7313b 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -192,7 +192,6 @@ exports.Stage = Montage.create(Component, { drawUtils._eltArray.length = 0; drawUtils._planesArray.length = 0; } else if(this._currentDocument.currentView === "design") { - this.showCodeViewBar(false); this.restoreAllPanels(); this.hideCanvas(false); this.showRulers(); @@ -200,7 +199,6 @@ exports.Stage = Montage.create(Component, { this.clearAllCanvas(); this.initWithDocument(); } else { - this.showCodeViewBar(true); this.collapseAllPanels(); this.hideCanvas(true); this.hideRulers(); @@ -1064,17 +1062,6 @@ exports.Stage = Montage.create(Component, { this.application.ninja.rulerLeft.style.display = "none"; } }, - showCodeViewBar:{ - value:function(isCodeView){ - if(isCodeView === true) { - - this.application.ninja.documentBar.element.style.display = "none"; - } else { - this.application.ninja.documentBar.element.style.display = "block"; - - } - } - }, collapseAllPanels:{ value:function(){ -- cgit v1.2.3