aboutsummaryrefslogtreecommitdiff
path: root/js/code-editor/ui/code-editor-view-options.reel
diff options
context:
space:
mode:
authorJose Antonio Marquez Russo2012-07-25 13:16:39 -0700
committerJose Antonio Marquez Russo2012-07-25 13:16:39 -0700
commit713278ed8a665122b7981769f3404958629f6a3d (patch)
tree8a180716f60bf87073233732753da65711c28732 /js/code-editor/ui/code-editor-view-options.reel
parentbb2f1d0e9a559f44348e95ad726801a5031aea3a (diff)
parente7509af2b2fad6ab23ea07e6e46e88a4ee0d03f1 (diff)
downloadninja-713278ed8a665122b7981769f3404958629f6a3d.tar.gz
Merge pull request #47 from ananyasen/Document
Code view fixes.
Diffstat (limited to 'js/code-editor/ui/code-editor-view-options.reel')
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html2
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js35
2 files changed, 33 insertions, 4 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 476db181..e6cc3763 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
@@ -80,7 +80,7 @@ POSSIBILITY OF SUCH DAMAGE.
80<body> 80<body>
81<div data-montage-id="viewOptions" class="viewOptions"> 81<div data-montage-id="viewOptions" class="viewOptions">
82 <div> 82 <div>
83 <input class="zoomFont" data-montage-id="zoomFont"/> 83 <input class="zoomFont" data-montage-id="zoomFont" style="display:none;"/>
84 <div class="autoCodeComplete" > 84 <div class="autoCodeComplete" >
85 <input type="checkbox" data-montage-id="codeComplete" /> 85 <input type="checkbox" data-montage-id="codeComplete" />
86 <label data-montage-id="autoCompleteLabel">Auto Code Hints</label> 86 <label data-montage-id="autoCompleteLabel">Auto Code Hints</label>
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 e2632d35..2ca6118b 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
@@ -51,14 +51,31 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
51 51
52 this._currentDocument = value; 52 this._currentDocument = value;
53 53
54 if(!value || (this._currentDocument.currentView === "design") || ((this._currentDocument.model.views.design !== null))) { 54 if(!value || (this._currentDocument.currentView === "design")) {
55 this.visible = false; 55 this.visible = false;
56 } else { 56 } else if(this._currentDocument && this._currentDocument.currentView === "code") {
57 this.visible = true; 57
58 if(this._currentDocument.model.views.design){//code view of design document
59 this.application.ninja.editorViewOptions.visible = false;
60 //this.application.ninja.documentBar.codeEditorControls.visible = false;//todo
61 }else if(!this._currentDocument.model.views.design){//code view for text document
62 this.application.ninja.editorViewOptions.visible = true;
63 //this.application.ninja.documentBar.codeEditorControls.visible = false;
64 }
65
58 this.autocomplete = !this.codeCompletionSupport[this._currentDocument.model.file.extension]; 66 this.autocomplete = !this.codeCompletionSupport[this._currentDocument.model.file.extension];
59 this._currentDocument.model.views.code.editor.automaticCodeHint = this.codeCompleteCheck.checked; 67 this._currentDocument.model.views.code.editor.automaticCodeHint = this.codeCompleteCheck.checked;
60 } 68 }
61 69
70 if(this._currentDocument && (this._currentDocument.currentView === "design")) {
71 this._currentDocument.addPropertyChangeListener("model.currentViewIdentifier", this, false);
72 }
73
74 //hide the zoom hottext if it is code view of a design file
75 if (this._currentDocument && this._currentDocument.model && this._currentDocument.model.views.code){
76 this.zoomHottext.element.style.display = "block";
77 }
78
62 } 79 }
63 }, 80 },
64 81
@@ -209,6 +226,18 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
209 } 226 }
210 }, 227 },
211 228
229 handleChange: {
230 value: function(notification) {
231 if(notification.currentPropertyPath === "model.currentViewIdentifier") {
232 if(this.currentDocument.model.currentView.identifier === "design-code") {
233 //this.application.ninja.documentBar.codeEditorControls.visible = false;//todo
234 } else {
235 //this.application.ninja.documentBar.codeEditorControls.visible = false;
236 }
237 }
238 }
239 },
240
212 handleFormat:{ 241 handleFormat:{
213 value: function(evt){ 242 value: function(evt){
214 var range = this.getSelectedRange(this.currentDocument.model.views.code.editor); 243 var range = this.getSelectedRange(this.currentDocument.model.views.code.editor);