diff options
author | Ananya Sen | 2012-07-23 16:59:56 -0700 |
---|---|---|
committer | Ananya Sen | 2012-07-23 16:59:56 -0700 |
commit | c07a7a9d11bc8299fa9686544b18840cc8e640c2 (patch) | |
tree | 274641ea13f5fba5c464fbcef2d49a7bc632071f /js/components | |
parent | d799a03a52fbf4eaad4e469fabbf84c9bf2cb41d (diff) | |
download | ninja-c07a7a9d11bc8299fa9686544b18840cc8e640c2.tar.gz |
show design code editor - first cut
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/components')
-rwxr-xr-x | js/components/layout/document-bar.reel/document-bar.js | 38 |
1 files changed, 37 insertions, 1 deletions
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, { | |||
61 | } | 61 | } |
62 | // | 62 | // |
63 | this.visible = true; | 63 | this.visible = true; |
64 | |||
65 | //TODO: check if the code's options bar can be unified | ||
66 | if(this._currentDocument && this._currentDocument.model && (this._currentDocument.model.views.design === null) && (this._currentDocument.model.views.code !== null)){ | ||
67 | this.visible = false; | ||
68 | } | ||
69 | } | ||
70 | }, | ||
71 | //////////////////////////////////////////////////////////////////// | ||
72 | // | ||
73 | _codeEditorWrapper:{ | ||
74 | value: null | ||
75 | }, | ||
76 | |||
77 | codeEditorWrapper:{ | ||
78 | get : function() { | ||
79 | return this._codeEditorWrapper; | ||
80 | }, | ||
81 | set : function(value) { | ||
82 | if(this._codeEditorWrapper !== value){ | ||
83 | this._codeEditorWrapper = value; | ||
84 | } | ||
64 | } | 85 | } |
65 | }, | 86 | }, |
66 | //////////////////////////////////////////////////////////////////// | 87 | //////////////////////////////////////////////////////////////////// |
@@ -101,7 +122,12 @@ exports.DocumentBar = Montage.create(Component, { | |||
101 | this._zoomFactor = value; | 122 | this._zoomFactor = value; |
102 | // | 123 | // |
103 | if (!this._firstDraw) { | 124 | if (!this._firstDraw) { |
104 | this.application.ninja.stage.setZoom(value); | 125 | if(this._currentDocument && this._currentDocument.model && this._currentDocument.model.currentView === this._currentDocument.model.views.design){ |
126 | this.application.ninja.stage.setZoom(value); | ||
127 | }else if(this._currentDocument && this._currentDocument.model && this._currentDocument.model.currentView === this._currentDocument.model.views.code){ | ||
128 | this._zoomFactor = value; | ||
129 | if(this.codeEditorWrapper){this.codeEditorWrapper.handleZoom(value)}; | ||
130 | } | ||
105 | } | 131 | } |
106 | } | 132 | } |
107 | } | 133 | } |
@@ -179,6 +205,14 @@ exports.DocumentBar = Montage.create(Component, { | |||
179 | }, | 205 | }, |
180 | //////////////////////////////////////////////////////////////////// | 206 | //////////////////////////////////////////////////////////////////// |
181 | // | 207 | // |
208 | renderCodeView: { | ||
209 | value: function () { | ||
210 | //Reloading in code view (with updates from other view) | ||
211 | this.reloadView('code', this.fileTemplate); | ||
212 | } | ||
213 | }, | ||
214 | //////////////////////////////////////////////////////////////////// | ||
215 | // | ||
182 | showViewDesign: { | 216 | showViewDesign: { |
183 | value: function () { | 217 | value: function () { |
184 | // | 218 | // |
@@ -203,6 +237,8 @@ exports.DocumentBar = Montage.create(Component, { | |||
203 | this._currentDocument.model.switchViewTo('code'); | 237 | this._currentDocument.model.switchViewTo('code'); |
204 | this.btnDesign.setAttribute('class', 'inactive'); | 238 | this.btnDesign.setAttribute('class', 'inactive'); |
205 | this.btnCode.removeAttribute('class'); | 239 | this.btnCode.removeAttribute('class'); |
240 | var render = this.renderCodeView.bind(this._currentDocument); | ||
241 | render(); | ||
206 | } | 242 | } |
207 | } | 243 | } |
208 | } | 244 | } |