aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/code-editor/code-editor-wrapper.js (renamed from js/controllers/code-editor-controller.js)29
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css5
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html8
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js69
-rwxr-xr-xjs/document/views/code.js2
-rwxr-xr-xjs/ninja.reel/ninja.html9
-rwxr-xr-xjs/ninja.reel/ninja.js2
7 files changed, 73 insertions, 51 deletions
diff --git a/js/controllers/code-editor-controller.js b/js/code-editor/code-editor-wrapper.js
index 4572d69a..942bd5cd 100644
--- a/js/controllers/code-editor-controller.js
+++ b/js/code-editor/code-editor-wrapper.js
@@ -9,7 +9,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component; 10 Component = require("montage/ui/component").Component;
11 11
12exports.CodeEditorController = Montage.create(Component, { 12exports.CodeEditorWrapper = Montage.create(Component, {
13 hasTemplate: { 13 hasTemplate: {
14 value: false 14 value: false
15 }, 15 },
@@ -34,6 +34,7 @@ exports.CodeEditorController = Montage.create(Component, {
34 } else if(this._currentDocument.currentView === "code") { 34 } else if(this._currentDocument.currentView === "code") {
35 this.autocomplete = this.codeCompletionSupport[this._currentDocument.model.file.extension]; 35 this.autocomplete = this.codeCompletionSupport[this._currentDocument.model.file.extension];
36 this._currentDocument.model.views.code.editor.focus(); 36 this._currentDocument.model.views.code.editor.focus();
37
37 this.applySettings(); 38 this.applySettings();
38 } 39 }
39 } 40 }
@@ -56,21 +57,6 @@ exports.CodeEditorController = Montage.create(Component, {
56 value: false 57 value: false
57 }, 58 },
58 59
59 _automaticCodeComplete: {
60 value:false
61 },
62
63 automaticCodeComplete:{
64 get: function(){
65 return this._automaticCodeComplete;
66 },
67 set: function(value) {
68 if(this._automaticCodeComplete !== value) {
69 this._automaticCodeComplete = value;
70 }
71 }
72 },
73
74 _editorTheme: { 60 _editorTheme: {
75 value:"default" 61 value:"default"
76 }, 62 },
@@ -93,7 +79,10 @@ exports.CodeEditorController = Montage.create(Component, {
93 return this._zoomFactor; 79 return this._zoomFactor;
94 }, 80 },
95 set: function(value) { 81 set: function(value) {
96 this.handleZoom(value); 82 if(value !== this._zoomFactor){
83 this._zoomFactor = value;
84 this.handleZoom(value);
85 }
97 } 86 }
98 }, 87 },
99 88
@@ -112,6 +101,10 @@ exports.CodeEditorController = Montage.create(Component, {
112 value:function(codeDocumentView, type, documentType, textDocument){ 101 value:function(codeDocumentView, type, documentType, textDocument){
113 var self = this, editorOptions = null; 102 var self = this, editorOptions = null;
114 103
104 if(!this.application.ninja.editorViewOptions.codeEditorWrapper){
105 this.application.ninja.editorViewOptions.codeEditorWrapper = this;
106 }
107
115 editorOptions = { 108 editorOptions = {
116 lineNumbers: true, 109 lineNumbers: true,
117 matchBrackets:true, 110 matchBrackets:true,
@@ -166,7 +159,7 @@ exports.CodeEditorController = Montage.create(Component, {
166 } 159 }
167 160
168 //===manually triggered code completion 161 //===manually triggered code completion
169 if((this.automaticCodeComplete === false)){ 162 if((this.currentDocument.model.views.code.editor.automaticCodeHint === false)){
170 if(keyEvent.ctrlKey && keyEvent.keyCode === 32){//Ctrl+Space 163 if(keyEvent.ctrlKey && keyEvent.keyCode === 32){//Ctrl+Space
171 this.codeEditor.simpleHint(cm, this.codeEditor.javascriptHint); 164 this.codeEditor.simpleHint(cm, this.codeEditor.javascriptHint);
172 } 165 }
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css
index 68d77f90..aeaf604c 100644
--- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css
+++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css
@@ -22,11 +22,6 @@
22 vertical-align: middle; 22 vertical-align: middle;
23} 23}
24 24
25.viewOptions .autoCodeComplete input{
26 width: 1em;
27 height: 1em;
28}
29
30.viewOptions .autoCodeComplete .disabled{ 25.viewOptions .autoCodeComplete .disabled{
31 color:#515151; 26 color:#515151;
32} 27}
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 3d5df256..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
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 04b509a6..6c983867 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
@@ -36,6 +36,21 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
36 } 36 }
37 }, 37 },
38 38
39 _codeEditorWrapper:{
40 value: null
41 },
42
43 codeEditorWrapper:{
44 get : function() {
45 return this._codeEditorWrapper;
46 },
47 set : function(value) {
48 if(this._codeEditorWrapper !== value){
49 this._codeEditorWrapper = value;
50 }
51 }
52 },
53
39 _visible: { 54 _visible: {
40 value: false 55 value: false
41 }, 56 },
@@ -97,6 +112,35 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
97 serializable: true 112 serializable: true
98 }, 113 },
99 114
115 _zoomFactor:{
116 value: 100
117 },
118
119 zoomFactor:{
120 get: function(){
121 return this._zoomFactor;
122 },
123 set: function(value){
124 this._zoomFactor = value;
125 if(this.codeEditorWrapper){this.codeEditorWrapper.handleZoom(value)};
126 }
127 },
128
129 _automaticCodeHint:{
130 value: false
131 },
132
133 automaticCodeHint:{
134 get: function(){
135 return this._automaticCodeHint;
136 },
137 set: function(value){
138 this._automaticCodeHint = value;
139 //additing additional meta properties on the editor
140 this._currentDocument.model.views.code.editor.automaticCodeHint = value;
141 }
142 },
143
100 themeSelect: { 144 themeSelect: {
101 value: null, 145 value: null,