aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-04-18 00:29:52 -0700
committerAnanya Sen2012-04-18 00:29:52 -0700
commitea4385add0e9087487ccded929c2d6674d326db8 (patch)
tree8018ac37696540c9e8609223c35ce458b70e26d3
parent35abad196cc9feb76ef50c1b63032a38233a6d51 (diff)
downloadninja-ea4385add0e9087487ccded929c2d6674d326db8.tar.gz
- collapse panels for code view, restore for design view
- apply theme selection to all code view documents Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css2
-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.js4
-rw-r--r--js/controllers/code-editor-controller.js18
-rwxr-xr-xjs/controllers/document-controller.js1
-rwxr-xr-xjs/ninja.reel/ninja.html4
-rwxr-xr-xjs/panels/Splitter.js35
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js21
8 files changed, 76 insertions, 11 deletions
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 91054fb9..79468768 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
@@ -20,10 +20,12 @@
20.viewOptions .format{ 20.viewOptions .format{
21 float:left; 21 float:left;
22 margin-left:5px; 22 margin-left:5px;
23 height: 20px;
23} 24}
24 25
25.viewOptions .themeOptions{ 26.viewOptions .themeOptions{
26 float: right; 27 float: right;
28 margin-right:5px;
27} 29}
28 30
29.viewOptions .themeOptions select{ 31.viewOptions .themeOptions select{
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 4a6cfa59..31e96adf 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
@@ -60,7 +60,7 @@
60 <button id="uncomment" value="uncomment" class="nj-skinned format">uncomment</button> 60 <button id="uncomment" value="uncomment" class="nj-skinned format">uncomment</button>
61 </div> 61 </div>
62 <div class="themeOptions"> 62 <div class="themeOptions">
63 <span>Theme</span> 63 <span>Theme :</span>
64 <select id="themeSelect"> 64 <select id="themeSelect">
65 <option value="default" selected="">DEFAULT</option> 65 <option value="default" selected="">DEFAULT</option>
66 <option value="night">NIGHT</option> 66 <option value="night">NIGHT</option>
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 0625dad9..237be46c 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
@@ -68,8 +68,8 @@ var CodeEditorViewOptions = exports.CodeEditorViewOptions = Montage.create(Compo
68 68
69 handleThemeSelection:{ 69 handleThemeSelection:{
70 value: function(evt){ 70 value: function(evt){
71 var theme = this.themeSelect.options[this.themeSelect.selectedIndex].value; 71 this.application.ninja.codeEditorController.editorTheme = this.themeSelect.options[this.themeSelect.selectedIndex].value;
72 this.application.ninja.codeEditorController.handleThemeSelection(theme); 72 this.application.ninja.codeEditorController.handleThemeSelection();
73 } 73 }
74 } 74 }
75 75
diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js
index cf0503a0..2302730c 100644
--- a/js/controllers/code-editor-controller.js
+++ b/js/controllers/code-editor-controller.js
@@ -33,9 +33,16 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone
33 33
34 automaticCodeComplete:{ 34 automaticCodeComplete:{
35 get: function(){return this._automaticCodeComplete;}, 35 get: function(){return this._automaticCodeComplete;},
36 set: function(value){ 36 set: function(value){this._automaticCodeComplete = value;}
37 //console.log("$$$ automaticCodeComplete setter : "+value); 37 },
38 this._automaticCodeComplete = value;} 38
39 _editorTheme: {
40 value:"default"
41 },
42
43 editorTheme:{
44 get: function(){return this._editorTheme;},
45 set: function(value){this._editorTheme = value;}
39 }, 46 },
40 47
41 originalEditorFont:{ 48 originalEditorFont:{
@@ -189,9 +196,8 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone
189 }, 196 },
190 197
191 handleThemeSelection:{ 198 handleThemeSelection:{
192 value: function(theme){ 199 value: function(){
193 this.application.ninja.documentController.activeDocument.editor.setOption("theme", theme); 200 this.application.ninja.documentController.activeDocument.editor.setOption("theme", this.editorTheme);
194 } 201 }
195 } 202 }
196
197}); \ No newline at end of file 203}); \ No newline at end of file
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 079eb754..0d9b37ed 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -434,6 +434,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
434// appDelegateModule.MyAppDelegate.onSetActiveDocument(); 434// appDelegateModule.MyAppDelegate.onSetActiveDocument();
435 435
436 this.application.ninja.stage.stageView.showCodeViewBar(false); 436 this.application.ninja.stage.stageView.showCodeViewBar(false);
437 this.application.ninja.stage.stageView.restoreAllPanels();
437 } 438 }
438 }, 439 },
439 440
diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html
index 8332e5f5..529dea30 100755
--- a/js/ninja.reel/ninja.html
+++ b/js/ninja.reel/ninja.html
@@ -395,7 +395,9 @@
395 "codeEditorController": {"@": "codeEditorController"}, 395 "codeEditorController": {"@": "codeEditorController"},
396 "rightPanelContainer": {"#": "rightPanelContainer" }, 396 "rightPanelContainer": {"#": "rightPanelContainer" },
397 "panelSplitter": {"@": "splitter3"}, 397 "panelSplitter": {"@": "splitter3"},
398 "timelineSplitter": {"@": "splitter4"} 398 "timelineSplitter": {"@": "splitter4"},
399 "toolsSplitter": {"@": "splitter2"},
400 "optionsSplitter": {"@": "splitter1"}
399 } 401 }
400 } 402 }
401 } 403 }
diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js
index 98ebb36a..0640abb2 100755
--- a/js/panels/Splitter.js
+++ b/js/panels/Splitter.js
@@ -55,7 +55,6 @@ exports.Splitter = Montage.create(Component, {
55 }, 55 },
56 set: function(value) { 56 set: function(value) {
57 this._collapsed = value; 57 this._collapsed = value;
58
59 this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value}); 58 this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value});
60 } 59 }
61 }, 60 },
@@ -139,5 +138,39 @@ exports.Splitter = Montage.create(Component, {
139 value: function() { 138 value: function() {
140 this.handleClick(); 139 this.handleClick();
141 } 140 }
141 },
142
143 collapse:{
144 value: function() {
145 if (this.collapsed === false) {
146 if(this.panel.element) {
147 this.panel.element.addEventListener("webkitTransitionEnd", this, false);
148 } else {
149 this.panel.addEventListener("webkitTransitionEnd", this, false);
150 }
151 this._collapsed = true;
152 this.needsDraw = true;
153 }
154 }
155 },
156 restore:{
157 value: function() {
158 //Get splitter initial value from SettingManager
159 var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")), temp = this.collapsed;
160 if(storedData && this.element.getAttribute("data-montage-id") !== null) {
161 this._collapsed = storedData.value;
162
163 } else {
164 this._collapsed = false;
165 }
166 if(temp != this._collapsed){
167 if(this.panel.element) {
168 this.panel.element.addEventListener("webkitTransitionEnd", this, false);
169 } else {
170 this.panel.addEventListener("webkitTransitionEnd", this, false);
171 }
172 this.needsDraw = true;
173 }
174 }
142 } 175 }
143}); 176});
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index c06ad988..bc8b469c 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -102,6 +102,7 @@ exports.StageView = Montage.create(Component, {
102 this.application.ninja.documentController.activeDocument = doc; 102 this.application.ninja.documentController.activeDocument = doc;
103 this.application.ninja.stage.hideCanvas(true); 103 this.application.ninja.stage.hideCanvas(true);
104 document.getElementById("iframeContainer").style.display="none";//hide the iframe when switching to code view 104 document.getElementById("iframeContainer").style.display="none";//hide the iframe when switching to code view
105 this.collapseAllPanels();
105 } 106 }
106 }, 107 },
107 108
@@ -128,11 +129,14 @@ exports.StageView = Montage.create(Component, {
128 //focus editor 129 //focus editor
129 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ 130 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){
130 this.application.ninja.documentController.activeDocument.editor.focus(); 131 this.application.ninja.documentController.activeDocument.editor.focus();
132 this.application.ninja.codeEditorController.handleThemeSelection();
133 this.collapseAllPanels();
131 } 134 }
132 135
133 if(this.application.ninja.documentController.activeDocument.currentView === "design") { 136 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
134 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe 137 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe
135 this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument();//reinitialize draw-util, snapmanager and view-util 138 this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument();//reinitialize draw-util, snapmanager and view-util
139 this.restoreAllPanels();
136 } 140 }
137 141
138 NJevent("switchDocument"); 142 NJevent("switchDocument");
@@ -182,5 +186,22 @@ exports.StageView = Montage.create(Component, {
182 this.application.ninja.editorViewOptions.element.style.display = "none"; 186 this.application.ninja.editorViewOptions.element.style.display = "none";
183 } 187 }
184 }