aboutsummaryrefslogtreecommitdiff
path: root/js/stage/stage-view.reel
diff options
context:
space:
mode:
authorAnanya Sen2012-05-31 10:13:40 -0700
committerAnanya Sen2012-05-31 10:13:40 -0700
commit286457b4f23974277274ba388afd283e8aa085cb (patch)
treec21bf791e7c4f572d12f97987ea6b89e74da67fe /js/stage/stage-view.reel
parent4d9b481c58090e8f1fc7b0e9d73a81b0f49cccc8 (diff)
parentd49c909cff7f0c5e5d0b127ad84a2fefc6677dc6 (diff)
downloadninja-286457b4f23974277274ba388afd283e8aa085cb.tar.gz
Merge branch 'refs/heads/ninja-internal-master' into cut-copy-paste
Conflicts: js/controllers/styles-controller.js Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/stage/stage-view.reel')
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js170
1 files changed, 0 insertions, 170 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index 518c3bdd..2c129ee2 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -25,122 +25,20 @@ exports.StageView = Montage.create(Component, {
25 } 25 }
26 }, 26 },
27 27
28 templateDidLoad: {
29 value: function() {
30 this.eventManager.addEventListener("appLoaded", this, false);
31 }
32 },
33
34 didDraw:{ 28 didDraw:{
35 value: function() { 29 value: function() {
36 if(!this.application.ninja.documentController._textHolder) this.application.ninja.documentController._textHolder = this.element; 30 if(!this.application.ninja.documentController._textHolder) this.application.ninja.documentController._textHolder = this.element;
37 } 31 }
38 }, 32 },
39 33
40 handleAppLoaded: {
41 value: function() {
42
43 // Don't bind for now
44 /*
45 Object.defineBinding(this, "docs", {
46 boundObject: this.application.ninja.documentController,
47 boundObjectPropertyPath: "_documents"
48 });
49 */
50
51 }
52 },
53
54 /**
55 * Public method
56 * Creates a textarea element which will contain the content of the opened text document.
57 */
58 createTextAreaElement: {
59 value: function(uuid) {
60 var codeMirrorDiv = document.createElement("div");
61 codeMirrorDiv.id = "codeMirror_" + uuid;
62 codeMirrorDiv.style.display = "block";
63 this.element.appendChild(codeMirrorDiv);
64
65 var textArea = document.createElement("textarea");
66 textArea.id = "code";
67 textArea.name = "code";
68 codeMirrorDiv.appendChild(textArea);
69
70 return textArea;
71 }
72 },
73
74 /**
75 * Public method
76 * Creates a new instance of a code editor
77 */
78 createTextView: {
79 value: function(doc) {
80 var type;
81 this.application.ninja.documentController._hideCurrentDocument();
82 this.hideOtherDocuments(doc.uuid);
83
84 switch(doc.documentType) {
85 case "css" :
86 type = "css";
87 break;
88 case "js" :
89 type = "javascript";
90 break;
91 case "html" :
92 type = "htmlmixed";
93 break;
94 case "json" :
95 type = "javascript";
96 break;
97 case "php" :
98 type = "php";
99 break;
100 case "pl" :
101 type = "perl";
102 break;
103 case "py" :
104 type = "python";
105 break;
106 case "rb" :
107 type = "ruby";
108 break;
109 case "xml" :
110 type = "xml";
111 break;
112 }
113 document.getElementById("codeMirror_"+doc.uuid).style.display="block";
114
115 doc.editor = this.application.ninja.codeEditorController.createEditor(doc, type, doc.documentType);
116 doc.editor.hline = doc.editor.setLineClass(0, "activeline");
117
118 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
119 this.application.ninja.documentController.activeDocument = doc;
120 this.application.ninja.stage.hideCanvas(true);
121 document.getElementById("iframeContainer").style.display="none";//hide the iframe when switching to code view
122
123 this.showCodeViewBar(true);
124 this.application.ninja.codeEditorController.applySettings();
125 this.collapseAllPanels();
126 }
127 },
128
129 /** 34 /**
130 * Public method 35 * Public method
131 * Switches between documents. Document state data is saved and restored whereever applicable 36 * Switches between documents. Document state data is saved and restored whereever applicable
132 */ 37 */
133 switchDocument:{ 38 switchDocument:{
134 value: function(doc){ 39 value: function(doc){
135 this.application.ninja.documentController._hideCurrentDocument();
136 this.application.ninja.documentController.activeDocument = doc;
137 40
138 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
139 this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument;
140 }
141 41
142 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
143 this.application.ninja.documentController._showCurrentDocument();
144 //focus editor 42 //focus editor
145 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ 43 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){
146 this.application.ninja.documentController.activeDocument.editor.focus(); 44 this.application.ninja.documentController.activeDocument.editor.focus();
@@ -160,73 +58,5 @@ exports.StageView = Montage.create(Component, {
160 58
161 NJevent("switchDocument"); 59 NJevent("switchDocument");
162 } 60 }
163 },
164
165 /**
166 * Public method
167 * Switches between different views of a design document, like HTML design view, HTML code view
168 */
169 switchDesignDocViews: {
170 value: function() {
171 //TODO
172 }
173 },
174
175 hideOtherDocuments:{
176 value:function(docUuid){
177 this.application.ninja.documentController._documents.forEach(function(aDoc){
178 if(aDoc.currentView === "design"){
179 aDoc.container.parentNode.style["display"] = "none";
180 }else if((aDoc.currentView === "code") && (aDoc.uuid !== docUuid)){
181 aDoc.container.style["display"] = "none";
182 }
183 }, this);
184 }
185 },
186 showRulers:{
187 value:function(){
188 this.application.ninja.rulerTop.style.display = "block";
189 this.application.ninja.rulerLeft.style.display = "block";
190 }
191 },
192 hideRulers:{
193 value:function(){
194 this.application.ninja.rulerTop.style.display = "none";
195 this.application.ninja.rulerLeft.style.display = "none";
196 }
197 },
198 showCodeViewBar:{
199 value:function(isCodeView){
200 if(isCodeView === true) {
201 this.application.ninja.editorViewOptions.element.style.display = "block";
202 this.application.ninja.documentBar.element.style.display = "none";
203 }else{
204 this.application.ninja.documentBar.element.style.display = "block";
205 this.application.ninja.editorViewOptions.element.style.display = "none";
206 }
207 }
208 },
209
210 collapseAllPanels:{
211 value:function(){
212 this.application.ninja.panelSplitter.collapse();
213 this.application.ninja.timelineSplitter.collapse();
214 this.application.ninja.toolsSplitter.collapse();
215 this.application.ninja.optionsSplitter.collapse();
216 }
217 },
218 restoreAllPanels:{
219 value:function(){
220 this.application.ninja.panelSplitter.restore();
221 this.application.ninja.timelineSplitter.restore();
222 this.application.ninja.toolsSplitter.restore();
223 this.application.ninja.optionsSplitter.restore();
224 }
225 },
226
227 applyTheme:{
228 value:function(themeClass){
229 this.element.className = "codeViewContainer "+themeClass;
230 }
231 } 61 }
232}); \ No newline at end of file 62}); \ No newline at end of file