aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js132
-rwxr-xr-xjs/stage/stage.reel/stage.js44
2 files changed, 43 insertions, 133 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index 757c5e51..2c129ee2 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -33,81 +33,6 @@ exports.StageView = Montage.create(Component, {
33 33
34 /** 34 /**
35 * Public method 35 * Public method
36 * Creates a textarea element which will contain the content of the opened text document.
37 */
38 createTextAreaElement: {
39 value: function(uuid) {
40 var codeMirrorDiv = document.createElement("div");
41 codeMirrorDiv.id = "codeMirror_" + uuid;
42 codeMirrorDiv.style.display = "block";
43 this.element.appendChild(codeMirrorDiv);
44
45 var textArea = document.createElement("textarea");
46 textArea.id = "code";
47 textArea.name = "code";
48 codeMirrorDiv.appendChild(textArea);
49
50 return textArea;
51 }
52 },
53
54 /**
55 * Public method
56 * Creates a new instance of a code editor
57 */
58 createTextView: {
59 value: function(doc) {
60 var type;
61 this.application.ninja.documentController._hideCurrentDocument();
62 this.hideOtherDocuments(doc.uuid);
63
64 switch(doc.documentType) {
65 case "css" :
66 type = "css";
67 break;
68 case "js" :
69 type = "javascript";
70 break;
71 case "html" :
72 type = "htmlmixed";
73 break;
74 case "json" :
75 type = "javascript";
76 break;
77 case "php" :
78 type = "php";
79 break;
80 case "pl" :
81 type = "perl";
82 break;
83 case "py" :
84 type = "python";
85 break;
86 case "rb" :
87 type = "ruby";
88 break;
89 case "xml" :
90 type = "xml";
91 break;
92 }
93 document.getElementById("codeMirror_"+doc.uuid).style.display="block";
94
95 doc.editor = this.application.ninja.codeEditorController.createEditor(doc, type, doc.documentType);
96 doc.editor.hline = doc.editor.setLineClass(0, "activeline");
97
98 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
99 this.application.ninja.documentController.activeDocument = doc;
100 this.application.ninja.stage.hideCanvas(true);
101 document.getElementById("iframeContainer").style.display="none";//hide the iframe when switching to code view
102
103 this.showCodeViewBar(true);
104 this.application.ninja.codeEditorController.applySettings();
105 this.collapseAllPanels();
106 }
107 },
108
109 /**
110 * Public method
111 * 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
112 */ 37 */
113 switchDocument:{ 38 switchDocument:{
@@ -133,62 +58,5 @@ exports.StageView = Montage.create(Component, {
133 58
134 NJevent("switchDocument"); 59 NJevent("switchDocument");
135 } 60 }
136 },
137
138 /**
139 * Public method
140 * Switches between different views of a design document, like HTML design view, HTML code view
141 */
142 switchDesignDocViews: {
143 value: function() {
144 //TODO
145 }
146 },
147
148 showRulers:{
149 value:function(){
150 this.application.ninja.rulerTop.style.display = "block";
151 this.application.ninja.rulerLeft.style.display = "block";
152 }
153 },
154 hideRulers:{
155 value:function(){
156 this.application.ninja.rulerTop.style.display = "none";
157 this.application.ninja.rulerLeft.style.display = "none";
158 }
159 },
160 showCodeViewBar:{
161 value:function(isCodeView){
162 if(isCodeView === true) {
163 this.application.ninja.editorViewOptions.element.style.display = "block";
164 this.application.ninja.documentBar.element.style.display = "none";
165 } else {
166 this.application.ninja.documentBar.element.style.display = "block";
167 this.application.ninja.editorViewOptions.element.style.display = "none";
168 }
169 }
170 },
171
172 collapseAllPanels:{
173 value:function(){
174 this.application.ninja.panelSplitter.collapse();
175 this.application.ninja.timelineSplitter.collapse();
176 this.application.ninja.toolsSplitter.collapse();
177 this.application.ninja.optionsSplitter.collapse();
178 }
179 },
180 restoreAllPanels:{
181 value:function(){
182 this.application.ninja.panelSplitter.restore();
183 this.application.ninja.timelineSplitter.restore();
184 this.application.ninja.toolsSplitter.restore();
185 this.application.ninja.optionsSplitter.restore();
186 }
187 },
188
189 applyTheme:{
190 value:function(themeClass){
191 this.element.className = "codeViewContainer "+themeClass;
192 }
193 } 61 }
194}); \ No newline at end of file 62}); \ No newline at end of file
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 73d3aaf4..f768f03a 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -1012,5 +1012,47 @@ exports.Stage = Montage.create(Component, {
1012 this._iframeContainer.scrollTop = this.application.ninja.documentController.activeDocument.savedTopScroll; 1012 this._iframeContainer.scrollTop = this.application.ninja.documentController.activeDocument.savedTopScroll;
1013 this._scrollTop = this.application.ninja.documentController.activeDocument.savedTopScroll; 1013 this._scrollTop = this.application.ninja.documentController.activeDocument.savedTopScroll;
1014 } 1014 }
1015 } 1015 },
1016
1017 showRulers:{
1018 value:function(){
1019 this.application.ninja.rulerTop.style.display = "block";
1020 this.application.ninja.rulerLeft.style.display = "block";
1021 }
1022 },
1023 hideRulers:{
1024 value:function(){
1025 this.application.ninja.rulerTop.style.display = "none";
1026 this.application.ninja.rulerLeft.style.display = "none";
1027 }
1028 },
1029 showCodeViewBar:{
1030 value:function(isCodeView){
1031 if(isCodeView === true) {
1032 this.application.ninja.editorViewOptions.element.style.display = "block";
1033 this.application.ninja.documentBar.element.style.display = "none";
1034 } else {
1035 this.application.ninja.documentBar.element.style.display = "block";
1036 this.application.ninja.editorViewOptions.element.style.display = "none";
1037 }
1038 }
1039 },
1040
1041 collapseAllPanels:{
1042 value:function(){
1043 this.application.ninja.panelSplitter.collapse();
1044 this.application.ninja.timelineSplitter.collapse();
1045 this.application.ninja.toolsSplitter.collapse();
1046 this.application.ninja.optionsSplitter.collapse();
1047 }
1048 },
1049 restoreAllPanels:{
1050 value:function(){
1051 this.application.ninja.panelSplitter.restore();
1052 this.application.ninja.timelineSplitter.restore();
1053 this.application.ninja.toolsSplitter.restore();
1054 this.application.ninja.optionsSplitter.restore();
1055 }
1056 }
1057
1016}); \ No newline at end of file 1058}); \ No newline at end of file