From 6075916ef18dc4a8cbea41c941d2d0b519360262 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 26 Jun 2012 13:04:04 -0700 Subject: fixed code hinting and autocompletion bug Signed-off-by: Ananya Sen --- .../ui/code-editor-view-options.reel/code-editor-view-options.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js') 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..04b509a6 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 @@ -121,6 +121,12 @@ exports.CodeEditorViewOptions = Montage.create(Component, { oneway : false }); + Object.defineBinding(this.codeCompleteCheck , "checked", { + boundObject: this.application.ninja.codeEditorController, + boundObjectPropertyPath: "automaticCodeComplete", + oneway : false + }); + } }, @@ -137,6 +143,8 @@ exports.CodeEditorViewOptions = Montage.create(Component, { } else { this.autoCompleteLabel.classList.remove("disabled"); } + + this.codeCompleteCheck.checked = false; } }, -- cgit v1.2.3 From 3391a8e6fd5df0d464edaffd98c2b3fde23acf5a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 26 Jun 2012 16:03:56 -0700 Subject: refactored to move bindings to template Signed-off-by: Ananya Sen --- .../code-editor-view-options.js | 69 ++++++++++++++++------ 1 file changed, 50 insertions(+), 19 deletions(-) (limited to 'js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js') 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, { } }, + _codeEditorWrapper:{ + value: null + }, + + codeEditorWrapper:{ + get : function() { + return this._codeEditorWrapper; + }, + set : function(value) { + if(this._codeEditorWrapper !== value){ + this._codeEditorWrapper = value; + } + } + }, + _visible: { value: false }, @@ -97,6 +112,35 @@ exports.CodeEditorViewOptions = Montage.create(Component, { serializable: true }, + _zoomFactor:{ + value: 100 + }, + + zoomFactor:{ + get: function(){ + return this._zoomFactor; + }, + set: function(value){ + this._zoomFactor = value; + if(this.codeEditorWrapper){this.codeEditorWrapper.handleZoom(value)}; + } + }, + + _automaticCodeHint:{ + value: false + }, + + automaticCodeHint:{ + get: function(){ + return this._automaticCodeHint; + }, + set: function(value){ + this._automaticCodeHint = value; + //additing additional meta properties on the editor + this._currentDocument.model.views.code.editor.automaticCodeHint = value; + } + }, + themeSelect: { value: null, serializable: true @@ -114,19 +158,6 @@ exports.CodeEditorViewOptions = Montage.create(Component, { this.uncomment.addEventListener("click", this.handleUncomment.bind(this), false); this.themeSelect.addEventListener("change", this.handleThemeSelection.bind(this), false); this.shortKeys.addEventListener("click", this.handleShortKeys.bind(this), false); - - Object.defineBinding(this.zoomHottext , "value", { - boundObject: this.application.ninja.codeEditorController, - boundObjectPropertyPath: "zoomFactor", - oneway : false - }); - - Object.defineBinding(this.codeCompleteCheck , "checked", { - boundObject: this.application.ninja.codeEditorController, - boundObjectPropertyPath: "automaticCodeComplete", - oneway : false - }); - } }, @@ -143,8 +174,6 @@ exports.CodeEditorViewOptions = Montage.create(Component, { } else { this.autoCompleteLabel.classList.remove("disabled"); } - - this.codeCompleteCheck.checked = false; } }, @@ -163,20 +192,22 @@ exports.CodeEditorViewOptions = Montage.create(Component, { handleComment:{ value: function(evt){ - this.application.ninja.codeEditorController.commentSelection(true); + if(this.codeEditorWrapper){this.codeEditorWrapper.commentSelection(true)}; } }, handleUncomment:{ value: function(evt){ - this.application.ninja.codeEditorController.commentSelection(false); + if(this.codeEditorWrapper){this.codeEditorWrapper.commentSelection(false)}; } }, handleThemeSelection:{ value: function(evt){ - this.application.ninja.codeEditorController.editorTheme = this.themeSelect.options[this.themeSelect.selectedIndex].value; - this.application.ninja.codeEditorController.handleThemeSelection(); + if(this.codeEditorWrapper){ + this.codeEditorWrapper.editorTheme = this.themeSelect.options[this.themeSelect.selectedIndex].value; + this.codeEditorWrapper.handleThemeSelection(); + } } }, -- cgit v1.2.3 From dd9c91e14708635dfaba2b31fd7f39938f719ab3 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 27 Jun 2012 10:29:35 -0700 Subject: initialize auto code hinting flag with checkbox value, on switching between documents Signed-off-by: Ananya Sen --- .../ui/code-editor-view-options.reel/code-editor-view-options.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js') 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 6c983867..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,6 +31,7 @@ exports.CodeEditorViewOptions = Montage.create(Component, { } else { this.visible = true; this.autocomplete = !this.codeCompletionSupport[this._currentDocument.model.file.extension]; + this._currentDocument.model.views.code.editor.automaticCodeHint = this.codeCompleteCheck.checked; } } -- cgit v1.2.3