aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-04-19 10:38:43 -0700
committerAnanya Sen2012-04-19 10:38:43 -0700
commit8cd6c76aabb4c75ab63f8d46b7e89bddbcbfe2a7 (patch)
tree3a4b2884e2ccc1dc45884ca12dfecebd5b6ec324
parentea4385add0e9087487ccded929c2d6674d326db8 (diff)
downloadninja-8cd6c76aabb4c75ab63f8d46b7e89bddbcbfe2a7.tar.gz
- fixed the text cursor
- code cleanup Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rw-r--r--js/controllers/code-editor-controller.js13
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.css2
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js18
3 files changed, 22 insertions, 11 deletions
diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js
index 2302730c..8757dceb 100644
--- a/js/controllers/code-editor-controller.js
+++ b/js/controllers/code-editor-controller.js
@@ -199,5 +199,18 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone
199 value: function(){ 199 value: function(){
200 this.application.ninja.documentController.activeDocument.editor.setOption("theme", this.editorTheme); 200 this.application.ninja.documentController.activeDocument.editor.setOption("theme", this.editorTheme);
201 } 201 }
202 },
203
204 applySettings:{
205 value:function(){
206 var codeLineElem = null, i=0;
207 //set theme
208 this.handleThemeSelection();
209 //check autocomplete support
210 this.handleCodeCompletionSupport(this.application.ninja.documentController.activeDocument.editor.getOption("mode"));
211 //set zoom
212 codeLineElem = this.application.ninja.documentController.activeDocument.container.getElementsByClassName("CodeMirror-lines")[0];
213 codeLineElem.style.fontSize = ""+this._editorFont+"px";
214 }
202 } 215 }
203}); \ No newline at end of file 216}); \ No newline at end of file
diff --git a/js/stage/stage-view.reel/stage-view.css b/js/stage/stage-view.reel/stage-view.css
index a7e255ae..4cf5b2ab 100755
--- a/js/stage/stage-view.reel/stage-view.css
+++ b/js/stage/stage-view.reel/stage-view.css
@@ -14,7 +14,7 @@
14 width: 100%; 14 width: 100%;
15 height: 100%; 15 height: 100%;
16 overflow:auto; 16 overflow:auto;
17 /*display: none;*/ 17 cursor:text;
18} 18}
19 19
20/* OLD CSS for reference 20/* OLD CSS for reference
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index bc8b469c..53eff90e 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -94,14 +94,13 @@ exports.StageView = Montage.create(Component, {
94 doc.editor = this.application.ninja.codeEditorController.createEditor(doc, type); 94 doc.editor = this.application.ninja.codeEditorController.createEditor(doc, type);
95 doc.editor.hline = doc.editor.setLineClass(0, "activeline"); 95 doc.editor.hline = doc.editor.setLineClass(0, "activeline");
96 96
97 this.showCodeViewBar(true);
98
99 this.application.ninja.codeEditorController.handleCodeCompletionSupport(type);
100
101 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe 97 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
102 this.application.ninja.documentController.activeDocument = doc; 98 this.application.ninja.documentController.activeDocument = doc;
103 this.application.ninja.stage.hideCanvas(true); 99 this.application.ninja.stage.hideCanvas(true);
104 document.getElementById("iframeContainer").style.display="none";//hide the iframe when switching to code view 100 document.getElementById("iframeContainer").style.display="none";//hide the iframe when switching to code view
101
102 this.showCodeViewBar(true);
103 this.application.ninja.codeEditorController.applySettings();
105 this.collapseAllPanels(); 104 this.collapseAllPanels();
106 } 105 }
107 }, 106 },
@@ -117,11 +116,6 @@ exports.StageView = Montage.create(Component, {
117 116
118 if(this.application.ninja.documentController.activeDocument.currentView === "design") { 117 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
119 this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; 118 this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument;
120
121 this.showCodeViewBar(false);
122 }else{
123 this.showCodeViewBar(true);
124 this.application.ninja.codeEditorController.handleCodeCompletionSupport(this.application.ninja.documentController.activeDocument.editor.getOption("mode"));
125 } 119 }
126 120
127 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe 121 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
@@ -129,13 +123,17 @@ exports.StageView = Montage.create(Component, {
129 //focus editor 123 //focus editor
130 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ 124 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){
131 this.application.ninja.documentController.activeDocument.editor.focus(); 125 this.application.ninja.documentController.activeDocument.editor.focus();
132 this.application.ninja.codeEditorController.handleThemeSelection(); 126
127 this.showCodeViewBar(true);
128 this.application.ninja.codeEditorController.applySettings();
133 this.collapseAllPanels(); 129 this.collapseAllPanels();
134 } 130 }
135 131
136 if(this.application.ninja.documentController.activeDocument.currentView === "design") { 132 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
137 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe 133 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe
138 this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument();//reinitialize draw-util, snapmanager and view-util 134 this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument();//reinitialize draw-util, snapmanager and view-util
135
136 this.showCodeViewBar(false);
139 this.restoreAllPanels(); 137 this.restoreAllPanels();
140 } 138 }
141 139