aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorAnanya Sen2012-04-13 16:51:50 -0700
committerAnanya Sen2012-04-13 16:51:50 -0700
commitc2ec390d42945d2df1aed3f2b7ff3d1aa722fce8 (patch)
treecaff16a00963bbaef55830b406d7da212f4f74d7 /js/controllers
parent6ffda1a7ebe18adb518eb24a612df22305b050a6 (diff)
downloadninja-c2ec390d42945d2df1aed3f2b7ff3d1aa722fce8.tar.gz
- code editor view options bar
- Checkbox for user to toggle between manually triggered autocomplete and automatic autocomplete - font zoom hottext Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/controllers')
-rw-r--r--js/controllers/code-editor-controller.js45
-rwxr-xr-xjs/controllers/document-controller.js1
2 files changed, 40 insertions, 6 deletions
diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js
index 0c13958c..534d4645 100644
--- a/js/controllers/code-editor-controller.js
+++ b/js/controllers/code-editor-controller.js
@@ -23,17 +23,37 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone
23 set: function(value){this._codeEditor = value;} 23 set: function(value){this._codeEditor = value;}
24 }, 24 },
25 25
26 codeCompletionSupport : {"javascript": true}, 26 codeCompletionSupport : {
27 value: {"javascript": true}
28 },
27 29
28 _automaticCodeComplete: { 30 _automaticCodeComplete: {
29 value:true 31 value:true
30 }, 32 },
31 33
32 automaticCodeComplete:{ 34 automaticCodeComplete:{
33 get: function(){return this._automaticCodeComplete;}, 35 get: function(){return this._automaticCodeComplete;},
34 set: function(value){this._automaticCodeComplete = value;} 36 set: function(value){
35 }, 37 //console.log("$$$ automaticCodeComplete setter : "+value);
38 this._automaticCodeComplete = value;}
39 },
40
41 originalEditorFont:{
42 value:"13"//px
43 },
36 44
45 _editorFont:{
46 value:null
47 },
48
49 editorFont:{
50 get: function(){return this._editorFont;},
51 set: function(value){//gets a zoom %
52 this._editorFont = (value/100) * CodeEditorController.originalEditorFont;
53 //set the font size
54 document.getElementsByClassName("codeViewContainer")[0].style.fontSize = ""+this._editorFont+"px";
55 }
56 },
37 57
38 deserializedFromTemplate: { 58 deserializedFromTemplate: {
39 value: function() { 59 value: function() {
@@ -70,11 +90,14 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone
70 }; 90 };
71 91
72 //configure auto code completion if it is supported for that document type 92 //configure auto code completion if it is supported for that document type
73 if(true){ 93 if(this.codeCompletionSupport[type] === true){
74 editorOptions.onKeyEvent = function(cm, keyEvent){self._codeCompletionKeyEventHandler.call(self, cm, keyEvent, type)}; 94 editorOptions.onKeyEvent = function(cm, keyEvent){self._codeCompletionKeyEventHandler.call(self, cm, keyEvent, type)};
75 } 95 }
76 96
77 var editor = self.codeEditor.fromTextArea(doc.textArea, editorOptions); 97 var editor = self.codeEditor.fromTextArea(doc.textArea, editorOptions);
98
99 //editor.setOption("theme", "night");
100
78 return editor; 101 return editor;
79 } 102 }
80 }, 103 },
@@ -128,6 +151,16 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone
128 return false; 151 return false;
129 } 152 }
130 } 153 }
131 } 154 },
132 155
156 handleCodeCompletionSupport:{
157 value:function(fileType){
158 var autoCodeCompleteElem = document.getElementsByClassName("autoCodeComplete")[0];
159 if(autoCodeCompleteElem && (this.codeCompletionSupport[fileType] === true)){
160 autoCodeCompleteElem.style.visibility = "visible";
161 }else if(autoCodeCompleteElem && !this.codeCompletionSupport[fileType]){
162 autoCodeCompleteElem.style.visibility = "hidden";
163 }
164 }
165 }
133}); \ No newline at end of file 166}); \ No newline at end of file
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index a308f191..9792c7f6 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -442,6 +442,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
442 NJevent("onOpenDocument", doc); 442 NJevent("onOpenDocument", doc);
443// appDelegateModule.MyAppDelegate.onSetActiveDocument(); 443// appDelegateModule.MyAppDelegate.onSetActiveDocument();
444 444
445 this.application.ninja.stage.stageView.showCodeViewBar(false);
445 } 446 }
446 }, 447 },
447 448