aboutsummaryrefslogtreecommitdiff
path: root/js/code-editor/ui
diff options
context:
space:
mode:
authorKruti Shah2012-06-27 12:41:35 -0700
committerKruti Shah2012-06-27 12:41:35 -0700
commit37fd59d6574b4230df5ff8022e300d8d310c380d (patch)
treea92e3c27e7fd6c9db942d99c3d91035a8230cdea /js/code-editor/ui
parentf57b0fe3640dbb4aa2e355d165225bc267c134c2 (diff)
parent8351c3685a6db703d1940817abc71f92ef4e1bd4 (diff)
downloadninja-37fd59d6574b4230df5ff8022e300d8d310c380d.tar.gz
Merge branch 'refs/heads/ninjainternalmaster' into Timeline-local-kruti
Diffstat (limited to 'js/code-editor/ui')
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html10
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js62
2 files changed, 58 insertions, 14 deletions
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html
index 4448e1f1..9871525b 100644
--- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html
+++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html
@@ -11,12 +11,13 @@
11 <script type="text/montage-serialization"> 11 <script type="text/montage-serialization">
12 { 12 {
13 "codeCompleteCheck":{ 13 "codeCompleteCheck":{
14 "prototype": "montage/ui/input-checkbox.reel", 14 "prototype": "montage/ui/native/input-checkbox.reel",
15 "properties": { 15 "properties": {
16 "element": {"#": "codeComplete"} 16 "element": {"#": "codeComplete"}
17 }, 17 },
18 "bindings": { 18 "bindings": {
19 "disabled": {"<-": "@owner.autocomplete"} 19 "disabled": {"<-": "@owner.autocomplete"},
20 "checked": {"<->": "@owner.automaticCodeHint"}
20 } 21 }
21 }, 22 },
22 23
@@ -29,6 +30,9 @@
29 "stepSize" :10, 30 "stepSize" :10,
30 "acceptableUnits" : ["%"], 31 "acceptableUnits" : ["%"],
31 "units" : "%" 32 "units" : "%"
33 },
34 "bindings": {
35 "value": {"<->": "@owner.zoomFactor"}
32 } 36 }
33 }, 37 },
34 38
@@ -54,7 +58,7 @@
54 <input class="zoomFont" data-montage-id="zoomFont"/> 58 <input class="zoomFont" data-montage-id="zoomFont"/>
55 <div class="autoCodeComplete" > 59 <div class="autoCodeComplete" >
56 <input type="checkbox" data-montage-id="codeComplete" /> 60 <input type="checkbox" data-montage-id="codeComplete" />
57 <label data-montage-id="autoCompleteLabel">Automatic Completion</label> 61 <label data-montage-id="autoCompleteLabel">Auto Code Hints</label>
58 </div> 62 </div>
59 <div class="floatButtons"> 63 <div class="floatButtons">
60 <!--<button disabled="disabled" id="format" value="format" class="nj-skinned format">Format</button>--> 64 <!--<button disabled="disabled" id="format" value="format" class="nj-skinned format">Format</button>-->
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
index 13c9a705..5a33909c 100644
--- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
+++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
@@ -31,11 +31,27 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
31 } else { 31 } else {
32 this.visible = true; 32 this.visible = true;
33 this.autocomplete = !this.codeCompletionSupport[this._currentDocument.model.file.extension]; 33 this.autocomplete = !this.codeCompletionSupport[this._currentDocument.model.file.extension];
34 this._currentDocument.model.views.code.editor.automaticCodeHint = this.codeCompleteCheck.checked;
34 } 35 }
35 36
36 } 37 }
37 }, 38 },
38 39
40 _codeEditorWrapper:{
41 value: null
42 },
43
44 codeEditorWrapper:{
45 get : function() {
46 return this._codeEditorWrapper;
47 },
48 set : function(value) {
49 if(this._codeEditorWrapper !== value){
50 this._codeEditorWrapper = value;
51 }
52 }
53 },
54
39 _visible: { 55 _visible: {
40 value: false 56 value: false
41 }, 57 },
@@ -97,6 +113,35 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
97 serializable: true 113 serializable: true
98 }, 114 },
99 115
116 _zoomFactor:{
117 value: 100
118 },
119
120 zoomFactor:{
121 get: function(){
122 return this._zoomFactor;
123 },
124 set: function(value){
125 this._zoomFactor = value;
126 if(this.codeEditorWrapper){this.codeEditorWrapper.handleZoom(value)};
127 }
128 },
129
130 _automaticCodeHint:{
131 value: false
132 },
133
134 automaticCodeHint:{
135 get: function(){
136 return this._automaticCodeHint;
137 },
138 set: function(value){
139 this._automaticCodeHint = value;
140 //additing additional meta properties on the editor
141 this._currentDocument.model.views.code.editor.automaticCodeHint = value;
142 }
143 },
144
100 themeSelect: { 145 themeSelect: {
101 value: null, 146 value: null,
102 serializable: true 147 serializable: true
@@ -114,13 +159,6 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
114 this.uncomment.addEventListener("click", this.handleUncomment.bind(this), false); 159 this.uncomment.addEventListener("click", this.handleUncomment.bind(this), false);
115 this.themeSelect.addEventListener("change", this.handleThemeSelection.bind(this), false); 160 this.themeSelect.addEventListener("change", this.handleThemeSelection.bind(this), false);
116 this.shortKeys.addEventListener("click", this.handleShortKeys.bind(this), false); 161 this.shortKeys.addEventListener("click", this.handleShortKeys.bind(this), false);
117
118 Object.defineBinding(this.zoomHottext , "value", {
119 boundObject: this.application.ninja.codeEditorController,
120 boundObjectPropertyPath: "zoomFactor",
121 oneway : false
122 });
123
124 } 162 }
125 }, 163 },
126 164
@@ -155,20 +193,22 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
155 193
156 handleComment:{ 194 handleComment:{
157 value: function(evt){ 195 value: function(evt){
158 this.application.ninja.codeEditorController.commentSelection(true); 196 if(this.codeEditorWrapper){this.codeEditorWrapper.commentSelection(true)};
159 } 197 }
160 }, 198 },
161 199
162 handleUncomment:{ 200 handleUncomment:{
163 value: function(evt){ 201 value: function(evt){
164 this.application.ninja.codeEditorController.commentSelection(false); 202 if(this.codeEditorWrapper){this.codeEditorWrapper.commentSelection(false)};
165 } 203 }
166 }, 204 },
167 205
168 handleThemeSelection:{ 206 handleThemeSelection:{
169 value: function(evt){ 207 value: function(evt){
170 this.application.ninja.codeEditorController.editorTheme = this.themeSelect.options[this.themeSelect.selectedIndex].value; 208 if(this.codeEditorWrapper){
171 this.application.ninja.codeEditorController.handleThemeSelection(); 209 this.codeEditorWrapper.editorTheme = this.themeSelect.options[this.themeSelect.selectedIndex].value;
210 this.codeEditorWrapper.handleThemeSelection();
211 }
172 } 212 }
173 }, 213 },
174 214