From c07a7a9d11bc8299fa9686544b18840cc8e640c2 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 23 Jul 2012 16:59:56 -0700 Subject: show design code editor - first cut Signed-off-by: Ananya Sen --- .../layout/document-bar.reel/document-bar.js | 38 +++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'js/components/layout/document-bar.reel') diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index dbb4fcad..194b9b23 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js @@ -61,6 +61,27 @@ exports.DocumentBar = Montage.create(Component, { } // this.visible = true; + + //TODO: check if the code's options bar can be unified + if(this._currentDocument && this._currentDocument.model && (this._currentDocument.model.views.design === null) && (this._currentDocument.model.views.code !== null)){ + this.visible = false; + } + } + }, + //////////////////////////////////////////////////////////////////// + // + _codeEditorWrapper:{ + value: null + }, + + codeEditorWrapper:{ + get : function() { + return this._codeEditorWrapper; + }, + set : function(value) { + if(this._codeEditorWrapper !== value){ + this._codeEditorWrapper = value; + } } }, //////////////////////////////////////////////////////////////////// @@ -101,7 +122,12 @@ exports.DocumentBar = Montage.create(Component, { this._zoomFactor = value; // if (!this._firstDraw) { - this.application.ninja.stage.setZoom(value); + if(this._currentDocument && this._currentDocument.model && this._currentDocument.model.currentView === this._currentDocument.model.views.design){ + this.application.ninja.stage.setZoom(value); + }else if(this._currentDocument && this._currentDocument.model && this._currentDocument.model.currentView === this._currentDocument.model.views.code){ + this._zoomFactor = value; + if(this.codeEditorWrapper){this.codeEditorWrapper.handleZoom(value)}; + } } } } @@ -179,6 +205,14 @@ exports.DocumentBar = Montage.create(Component, { }, //////////////////////////////////////////////////////////////////// // + renderCodeView: { + value: function () { + //Reloading in code view (with updates from other view) + this.reloadView('code', this.fileTemplate); + } + }, + //////////////////////////////////////////////////////////////////// + // showViewDesign: { value: function () { // @@ -203,6 +237,8 @@ exports.DocumentBar = Montage.create(Component, { this._currentDocument.model.switchViewTo('code'); this.btnDesign.setAttribute('class', 'inactive'); this.btnCode.removeAttribute('class'); + var render = this.renderCodeView.bind(this._currentDocument); + render(); } } } -- cgit v1.2.3